Accueil
> professional > Small Wicket tips
Small Wicket tips
[Cet article est également disponible en français.]
In the last weeks, I’ve been doing quite some Wicket work.
Here are some small tips gathered on the way
- If you use an AjaxButton, don’t forget to override onError and to add a feedback panel to the target! Indeed, an AjaxButton triggers form validation. And if this fails, then feedback messages should have been created on the way. Having them displayed is kind of handy
. - Know and use Component.setRenderBodyOnly(boolean renderTag).This little method allows to skip the component tag when rendering. Doesn’t sound crazy like that, but comes handy when one has an optional fieldset.
- FormComponent.updateModel() is only effective if the new model object isn’t equal to the previous one.Indeed, FormComponent.updateModel() calls Component.setDefaultModelObject(), when checks for non equality before setting the new object. Why ? It saves making an extra page version if no change was done. Yet, if your equals isn’t appropriate, this may result in changes not being done for no visible reason. To avoid this, override Component.getModelComparator() and provide an appropriate comparator, like one testing only for same reference equality.
Hopefully it may help someone
++
joseph
Commentaires (0)
Rétroliens (0)
Poster un commentaire
Rétrolien