File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes Struts and the fly likes Collection in request Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Frameworks » Struts
Bookmark "Collection in request" Watch "Collection in request" New topic

Collection in request

Albert Gorski

Joined: Sep 17, 2003
Posts: 2
I have follwoing problem:
- in Action I add new attribute to REQUEST of Collection type
- in jsp page I can obtain the data (to fill Selection)
- !!! in Action, after submit, Collection attribute does not exist anymore.
Any hints how to pass Collection from JSP to Action class in request?

I do not want to use session as a cache because it is memory expensive.
Thanks for any help.
Junilu Lacar

Joined: Feb 26, 2001
Posts: 6529

Request-scoped attributes exist only during the lifetime of the request (go figure). Once the request has been processed and the response sent back, the request and all attributes tied to it go away. You need to add a field to your ActionForm that is of type Collection and the corresponding getters and setters. You can find more info on this on the web by searching for "struts indexed properties" (seems to be a hot topic these days).

Junilu - [How to Ask Questions] [How to Answer Questions]
I agree. Here's the link:
subject: Collection in request
It's not a secret anymore!