
Wicket posee un excelente soporte para Ajax, en este ejemplo haremos una actualización básica de algunos componentes( hacerlos visibles o invisibles) con solo hacer click sobre los enlaces sin afectar a los demás componentes.
Código:
Label label1 = new Label("label1","Hola mundo");
label1.setOutputMarkupPlaceholderTag(true);
AjaxLink link = new AjaxLink("link") {
public void onClick(AjaxRequestTarget target) {
label1.setVisible(true);
target.addComponent(label1);
}
};
AjaxLink link2 = new AjaxLink("link2") {
public void onClick(AjaxRequestTarget target) {
label1.setVisible(false);
target.addComponent(label1);
}
};
label1.setVisible(false);
form.add(link);
form.add(link2);
form.add(label1);
add(form);
CODIGO HTML
< span wicket:id="label"/ > < /span>
< a wicket:id="link">Aparecer< /a>
< a wicket:id ="link2">Ocultar < /a>

Es importante recordar que NetBeans 6.8 Ofrece un excelente soporte para Wicket, la versión beta NetBeans 6.9 aun no tiene el soporte para Wicket.
Comments