aspose file tools*
The moose likes JSF and the fly likes Submitting Input Fields In a Datatable Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » JSF
Bookmark "Submitting Input Fields In a Datatable" Watch "Submitting Input Fields In a Datatable" New topic
Author

Submitting Input Fields In a Datatable

Eric Richer
Greenhorn

Joined: Jun 19, 2009
Posts: 2
Hi everyone,

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:

Bertjan Underhill
Greenhorn

Joined: Aug 25, 2008
Posts: 12
Hello,

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.

Bertjan



><((((º>`·.¸¸.·´¯`·.¸.·´¯`·...¸><((((º>`·.¸¸.·´¯`·.¸¸.·´¯`·.. ><((((º>`·.¸¸.·´¯`·.¸.·´¯`·...¸><((((º>
Eric Richer
Greenhorn

Joined: Jun 19, 2009
Posts: 2
Hey Bertjan,

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.

Thanks for the input.

Cheers
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Submitting Input Fields In a Datatable