I have a list of user defined objects to iterate over using logic:iterate. The values of the object are being displayed in a text box so that the users can update the values. After th user updates the value in the front end,I am not able to retrieve the corresponding line item modified.
Assuming there are 5 line items being displayed using logic:iterate over a list (list contains objects of user defined class), if the user needs to update a value in thatz present in the 3rd line item, using an id field(property in the user defined class), iam able to determine the row. but in the action class when the form bean's object is accessed the 1sr line item's values are retrieved rather than the 3rd.
you may want to have a unique id associated with each line item (another property inside the user-defined object) rather than using the index of the list. especially when line items can be removed or added that can throw the index out of whack going from JSP into form then to your action. -/a
-/a<br />certified slacker...yes, my last name is 'do' - <a href="http://www.luckycouple.com" target="_blank" rel="nofollow">luckycouple.com</a>
Joined: Sep 07, 2004
I do have an unique id associated with each line item... (ie) concernId My problem is if i want to update a value in the 3rd LItem, then iam not able to get the handle to the altered LItem. In the action class, i have the formbean's object... but it always contains the value of the first LItem.
Joined: Apr 14, 2005
i see what the problem is. you must set your value objects values into the ActionForm that is mapped that that action, not putting it into a "formbean". (unless your WSREditFormBean IS the name of the form you mapped that action to, in which case i misunderstood).
you then need to access the line items by iterating through the "MyForm.map.myItems". in your case, you'll need to do the following:
1. form-bean definition must contain <form-bean name="ConcernForm".../> <form-property name="custConcerns" type="bean.ConcernVO"/>
2. your action execute method then populates the properties using form.set("custConcerns",ConcernsVO)
3. in your logic:iterate, you need to access the form by something like... <logic:iterate id="custConId" name="ConcernForm.map.custConcerns" property = "custConcerns" type="bean.ConcernsVO">
subject: iterating over a user defined class object using logic iterate