File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes JSF and the fly likes How to Create Repeated Fields? Big Moose Saloon
  Search | Java FAQ | Recent Topics
Register / Login


Win a copy of The Mikado Method this week in the Agile and other Processes forum!
JavaRanch » Java Forums » Java » JSF
Reply Bookmark "How to Create Repeated Fields?" Watch "How to Create Repeated Fields?" New topic
Author

How to Create Repeated Fields?

Phoenix Kilimba
Ranch Hand

Joined: Oct 10, 2006
Posts: 64
Dear Sirs et Madames,
I wish to create a JSF page which collects a number of details (e.g first, middle and last name, gender, age, location) from an initially unknown number of members of a household (household has a one-to-many-relationship with members, but we dont know how many members there will be). Therefore I would like to be able to have a row of components which will capture these attributes' values for a single member and at the end of the row I should have 2 buttons, one to SUBMIT or the other to ADD ANOTHER MEMBER. If the ADD ANOTHER MEMBER button is clicked, then this should result in a new row of exactly the same fields that captured the previous members information, and so on until there are no more users to add and the data entrant clicks on submit.

How does one go about achieving this result?

Thanks in advance


You are what you know
Max Neves
Greenhorn

Joined: Sep 24, 2009
Posts: 7
Hi, I've already done something similar using the Facelet 'ui:repeat' and Ajax4JSF 'a4j:repeat'.
In general lines, ui:repeat points to the object-list (like "value=#{bean.objectList}") and we loop using var.
Whenever you add an object to your object-list (e.g. by firing an action with a commandButton), you re-render the page and ui:repeat will now loop over the updated 'objectList'. a4j:repeat works similar.
Google these terms to get some examples.
suresh dasari
Ranch Hand

Joined: Oct 05, 2009
Posts: 120

Hi,

by using ui:repeat I can able to add rows dynamically, but how to set the modified values to backing back as the setters not calling validation is failing.


Sun Certified Java Programmer with 93 percent
 
I agree. Here's the link: http://ej-technologies/jprofiler - if it wasn't for jprofiler, we would need to run our stuff on 16 servers instead of 3.
 
subject: How to Create Repeated Fields?
 
Similar Threads
how to do it?
how to do it?
how to do it?
how to do it?
Please help with the 3 Hardest Javascript problems in the world