Wicket: Forms & ListViews

  • When using ListViews within Forms, don’t use ListViews within forms! preferably you should use something else like RepeatingView.

http://cwiki.apache.org/WICKET/listview-and-other-repeaters.html#ListViewandotherrepeaters-Usingformcomponentsinarepeater

  • If you do have to use ListViews, make sure you “setReuseItems(true)” or else the form will not remember the values you have typed in for each row in the view.
  • When setting the value of an object, make sure you set the model or somehow let wicket know of the underlying change.
void onSelectionChanged(VO newSelection) {

  textVO.setText("hello");
  textWidget.getModel().modelChanged();  // <-- GOOD a bit verbose but lets wicket know that model has changed.
   //----------------------------------------------------
  textVO.setText("hello");               // <--- BAD. wicket doesn't know that the model that wraps this VO has changed.  widget won't reflect change.
}

It's only fair to share...
Share on FacebookGoogle+Tweet about this on TwitterShare on LinkedIn

Leave a Reply