This week's giveaway is in the Android forum.
We're giving away four copies of Android Security Essentials Live Lessons and have Godfrey Nolan on-line!
See this thread for details.
The moose likes Struts and the fly likes losing arraylist from request when form submits 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 "losing arraylist from request when form submits" Watch "losing arraylist from request when form submits" New topic
Author

losing arraylist from request when form submits

Paul wilk
Greenhorn

Joined: Nov 21, 2005
Posts: 3
I've been trying to solve this problem for a while but with no success, here's the details....

1) I've a an arraylist (each element is a bean) in the request

2) On my JSP page I iterate through the collection to display the details, on each line of
the display I add a html:text element (all this is within a html:form -ActionForm)

My issue is when the form is submitted, if the form returns validation errors then I go back
to the same JSP page correctly but I've now lost my arraylist in the request.

How can I get around this (without using SESSION scope or without recreating the arraylist from
the database)?

Hope you can help.
Marc Peabody
pie sneak
Sheriff

Joined: Feb 05, 2003
Posts: 4727

If you refuse to use session, your only option is to create hidden fields on your JSP for the arraylist's values so the values are available in the subsequent request.

To make it easy to keep track of the values, I often will place the data in my ActionForm rather than placing the values into request scope directly.
[ December 27, 2005: Message edited by: Marc Peabody ]

A good workman is known by his tools.
 
It is sorta covered in the JavaRanch Style Guide.
 
subject: losing arraylist from request when form submits
 
Similar Threads
Save JSP output as.html
request scoped form
Struts 1 display ArrayList particular Element
forms and input
get disabled values from HttpServletRequest parameter