I'm trying to solve a problem which I would seem to think is quite intuitive to solve but just can't seem to get it going. Any suggestions you can offer would be greatly appreciated.
Basically, I have a managed bean in the request scope which contains a List<String>.
I create a datatable (actually its a RichFaces datatable) which iterates through the List above and creates an input text field for every entry. My problem is when I submit the form, the List in the managed bean is not updated and remains empty. I'm completely at a loss as to how to make this work. I've even tried binding the table to a back bean and iterating through the children of the HtmlDataTable object with no success. To make sure I am understanding things properly, I even added a simple input text field outside the datatable to make sure it was properly submitted.
Here is my page code:
Here is my managed-bean:
Joined: Aug 25, 2008
First a comment, id is unique. So two times id="id_cosName" is not a good idea.
You can try to put the managed bean in session scope. Maybe that will work.
The duplicate ID is just a spelling error. Putting the managed bean in session scope definately makes things easier. In the request scope though it is possible to make it work. I ended up getting the behaviour I want by accessing the parameter map in the HttpServletRequest and then manually populating the List. I'm guessing there isn't inherent support in the datatable for restoring a property of type List as the property's setter method is never even invoked.