• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

How we add multiple Row input using dataTable in JSF

 
Greenhorn
Posts: 7
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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
 
Ranch Hand
Posts: 140
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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
Posts: 7
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi,

I do the same thing, but it wont work.Anybody having souce code for this example
reply
    Bookmark Topic Watch Topic
  • New Topic