Wednesday, March 17, 2010

Editing tables with modal panels with RichFaces and Seam

A typical GUI use case is to be able to edit a table with a modal dialog (one row at a time). This is easily done with RichFaces and Seam.

In the template we define a datatable and the modal dialogues that are displayed when we right-click on the row.

Note that:
Due to a limitation in JSF, UIInputs that do not fail validation are sticky i.e. they retain their values through multiple requests. This behavior makes sense on many occasions as most of the time users will just correct the errors and resubmit the form, but on the odd occasion is not really desirable such as when using a form to display multiple objects selected by Ajax requests like in this case since if we leave some empty values in the form and select another row the new values selected will not be shown in the panel. See

That's why we have a cancel() method that clears submitted values if we close the dialog while we still have validation errors.


  1. This comment has been removed by the author.

  2. what is DemoInventoryItem in this