File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes Struts and the fly likes Not able to persist my arrayList in Struts2 Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of Android Security Essentials Live Lessons this week in the Android forum!
JavaRanch » Java Forums » Frameworks » Struts
Bookmark "Not able to persist my arrayList in Struts2" Watch "Not able to persist my arrayList in Struts2" New topic

Not able to persist my arrayList in Struts2

Shyam Sampath

Joined: Jun 28, 2011
Posts: 1

I have recently started using Struts2. I have a jsp which iterates through an ArrayList of JavaBeans. And the jsp has some form fields for user input. The input data is stored in Arraylist as beans. As and when the user inputs data it ll displayed as rows one below the other. The problem I am facing is that I am not able to persist the arraylist, i.e. when the first data is entered it works fine. But when the second data is entered it replaces the first one instead of getting appended with it. I tried making the ArrayList hidden, but no luck. Could any one of you please help me with this issue?

I have attached the code for your reference.

This is my JSP

This is my action class

Joe Ess

Joined: Oct 29, 2001
Posts: 8839

You'll have to look into using indexed properties.

"blabbing like a narcissistic fool with a superiority complex" ~ N.A.
[How To Ask Questions On JavaRanch]
I agree. Here's the link:
subject: Not able to persist my arrayList in Struts2
Similar Threads
how to connect to database and display query vqlus using proper java/jsp
Struts2 variable inside javascript
Passing arraylist as hidden variable in JSP Struts2 framework
Update Database with the newly entered value
s:iterator question