File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
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

Win a copy of EJB 3 in Action this week in the EJB and other Java EE Technologies forum!
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
It is sorta covered in the JavaRanch Style Guide.
subject: How Do I Update An ArrayList in an ActionForm?
Similar Threads
Array List - How Do I?
checkbox, arraylist
Can one action be mapped to more than one ActionForm?
Sorting Arraylist