|
(1) Have a Vector / Collection of contributors (ie.
getContributors()) belonging to your form. Inside that function, check to
see if you need more rows by using code similar to the following:
public Vector
getCustomerContacts()
{ CustomerContact lastCustomerContact = (CustomerContact)this.customerContacts.lastElement(); if (!lastCustomerContact.isEmpty()) // is this slot being used? this.customerContacts.addElement(new CustomerContact()); // always have one available slot at the end of the matrix return this.customerContacts; } (2) Do not use the reset() method.
(3) On your JSP, use code like this:
<% int i = 0;
%>
<logic:iterate id="customerContact" name="adminUpdateProfileForm" property="customerContacts"> <tr> <td class="smallFont"><input type='text' name="customerContact[<%= i %>].contactName" value="<%= ((com.domain.project.CustomerContact)customerContact).getContactName() %>"></td> <td class="smallFont"><input type='text' name="customerContact[<%= i %>].contactTitle" value="<%= ((com.domain.project.CustomerContact)customerContact).getContactTitle() %>"></td> <td class="smallFont"><input type='text' name="customerContact[<%= i %>].contactPhone" value="<%= ((com.domain.project.CustomerContact)customerContact).getContactPhone() %>"></td> </tr> <% i++; %> </logic:iterate> (4) Have a button on the form "Add more rows" in
which case the form posts to itself and will cause a new row to be added at the
bottom of the grid.
Hope this help,
Jeff
|
Title: Question on the ActionForm design for dynamic data?
- Question on the ActionForm design for dynamic data? Joyce Tang
- Re: Question on the ActionForm design for dynamic data... Jeff Trent
- Re: Question on the ActionForm design for dynamic ... Ellen Lockhart
- Re[2]: Question on the ActionForm design for d... Oleg V Alexeev
- Re: Question on the ActionForm design for dynamic data... Jeff Trent
- RE: Question on the ActionForm design for dynamic data... Joyce Tang
- RE: Question on the ActionForm design for dynamic data... Joyce Tang
- Re: Question on the ActionForm design for dynamic data... Jeff Trent

