• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other all forums
this forum made possible by our volunteer staff, including ...
  • Campbell Ritchie
  • Devaka Cooray
  • Knute Snortum
  • Paul Clapham
  • Tim Cooke
  • Liutauras Vilda
  • Jeanne Boyarsky
  • Bear Bibeault
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Ron McLeod
  • Piet Souris
  • Frits Walraven
  • Ganesh Patekar
  • Tim Holloway
  • salvin francis

losing arraylist from request when form submits  RSS feed

Posts: 3
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
pie sneak
Posts: 4727
Mac Ruby VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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 ]
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!