| 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
|
 |
 |
|
|
subject: How to Create Repeated Fields?
|
|
|