You need to ensure that exactly the same datamodel is preserved during the apply request values phase of the form submit as it was during the render response phase of the initial page display. A normal place is to do the preloading is the constructor of the backing bean.
public class Bean {
private List<Item> items;
public Bean() {
items = itemDAO.list();
}
// ...
}
An alternative is to put the bean in the session scope, but this has more impact on user experience.
Since you're using Tomahawk, you can also just set the preserveDataModel
attribute of the t:dataTable
to true
like so:
<t:dataTable preserveDataModel="true">
This will store the datamodel in the view's component tree (which in turn is stored in the session scope) so that exactly the same datamodel is available in the subsequent request.
See also:
BalusC
2010-07-06 10:33:46