This week's book giveaway is in the OO, Patterns, UML and Refactoring forum.
We're giving away four copies of Refactoring for Software Design Smells: Managing Technical Debt and have Girish Suryanarayana, Ganesh Samarthyam & Tushar Sharma on-line!
See this thread for details.
The moose likes Struts and the fly likes How Do I Update An ArrayList in an ActionForm? Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

JavaRanch » Java Forums » Frameworks » Struts
Bookmark "How Do I Update An ArrayList in an ActionForm?" Watch "How Do I Update An ArrayList in an ActionForm?" New topic

How Do I Update An ArrayList in an ActionForm?

amchi gelo
Ranch Hand

Joined: Jul 01, 2002
Posts: 75

I have an ActionForm bean that contains an ArrayList of records that I display in a JSP file using the <logic:iterate> tag. My problem is these records are updateable fields, so how do I code it so that it catches the changes? As of now, the setter for the ArrayList is not called at all, so there is no update and it remains stuck at the previous values. I have a workaround where I get the values from the request in the Action class and update the ArrayList there. How do I do it in a more Struts way?


Sun Certified Web Component Developer 1.4<br />Sun Certified Java Developer 1.4<br />IBM Certified Associate Developer - WebSphere Studio, V5.0 (285)<br />IBM Certified Specialist - IBM WebSphere Application Server, Adv Single Server Edition for Multiplatforms, V4.0 (158)<br />IBM Certified Solutions Expert - IBM Websphere Studio V4.0 (487)<br />IBM Certified Specialist - IBM Visual Age for Java V4.0 (283)<br />Sun Certified Java Programmer 1.2
Merrill Higginson
Ranch Hand

Joined: Feb 15, 2005
Posts: 4864
Just use the <logic:iterate> tag in combination with <html:text> or other input tags. The link below shows how to do this.

Consultant, Sima Solutions
I agree. Here's the link:
subject: How Do I Update An ArrayList in an ActionForm?
It's not a secret anymore!