Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.
Comment: Migrated to Confluence 5.3

...

Code Block
...

	protected class MyBehavior extends AbstractDefaultAjaxBehavior {
		@Override
		protected void onComponentTag(ComponentTag tag) {
			super.onComponentTag(tag);
			String js = "{wicketAjaxGet('" + getCallbackUrl() + "&'+this.name+'='+wicketEncode(this.value)); return false;}";
			tag.put("onblur", js);
		}

		@Override
		protected void respond(AjaxRequestTarget target) {
			FormComponent c = (FormComponent) getEditorComponentgetMyComponent();
			c.processInput();
			if (c.hasErrorMessage()) {
				Serializable msg = c.getFeedbackMessage().getMessage();
				// do something with the message
			}
		}
	}

...

Adding ajax to events:

Code Block

body.add(new AjaxEventBehavior("onload"){
	protected void onEvent(AjaxRequestTarget target){
		// do something
	}
});