aspose file tools*
The moose likes JSF and the fly likes How we add multiple Row input using dataTable in JSF Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Java 8 in Action this week in the Java 8 forum!
JavaRanch » Java Forums » Java » JSF
Bookmark "How we add multiple Row input using dataTable in JSF" Watch "How we add multiple Row input using dataTable in JSF" New topic
Author

How we add multiple Row input using dataTable in JSF

Vimal Bharathi Andiappan
Greenhorn

Joined: Jun 12, 2008
Posts: 7
When we click the add button then new row wants to create that one also used to get the user information. For that how we a code for that.

Example, a user wants to enter set of Username and phone no. Initially the page display 5 rows after clicking the new button then one more row wants to add .

For this add button code i tried but i not get it. Any body knows that please give reply
Darryl Nortje
Ranch Hand

Joined: Jun 11, 2002
Posts: 140
Hi Vimal,

This is done quite easily. Firstly, there is no need to have 5 empties, and then add one, although you can do that if you want, it'll just require some double checking on the server side, as to which rows are in fact filled in.

But this is what you do basically.

Use a dataTable in your jsp. For each row, have input elements. The dataTable can point to a List on your bean that can contain 1 empty object, say User object.

Have a commandButton that adds an empty User object to this list. That will in essence add a new row to your dataTable.

Then finally a "batch" Add all button that just goes through all the User objects in the list adding each one as necessary.
Vimal Bharathi Andiappan
Greenhorn

Joined: Jun 12, 2008
Posts: 7
Hi,

I do the same thing, but it wont work.Anybody having souce code for this example
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: How we add multiple Row input using dataTable in JSF
 
Similar Threads
GridLayout
Dynamic row generation using struts
nested FORM
updating jTable
JTable-new rows