File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes Struts and the fly likes Passing request attributes when doing forward - redirect Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Frameworks » Struts
Bookmark "Passing request attributes when doing forward - redirect" Watch "Passing request attributes when doing forward - redirect" New topic
Author

Passing request attributes when doing forward - redirect

Maciej Kolodziej
Greenhorn

Joined: Feb 11, 2002
Posts: 26
Hi,
How can I pass request attributes between actions if the forward the first action use is redirect="true"?
I mean I have an action which has at its end:

Where open logical is defined as:

How can I pass the attribute from the first action to open_logical.do action?
Is putting it into session the only way?
Thanks,
[ January 23, 2003: Message edited by: Maciej Kolodziej ]

MK
Jason Menard
Sheriff

Joined: Nov 09, 2000
Posts: 6450
You can't pass request attributes like you want when redirect="true". The reason is that there is another request generated. With a redirect, the response returned to the client tells the client to request another URL, which of course initiates another request-response cycle, so you will lose whatever you placed into request.
Maciej Kolodziej
Greenhorn

Joined: Feb 11, 2002
Posts: 26
Hi,
I know that. But is there any way to set this another url to have some parameters? Particularly the ones I take from the first request?
David Hibbs
Ranch Hand

Joined: Dec 19, 2002
Posts: 374
It's kind of kludge-ish, but you can create a new ActionForward and initialize it with its setters and the getters from the original, then return the copy.
i.e.

Or you can avoid having to do the redirect.
:roll:


"Write beautiful code; then profile that beautiful code and make little bits of it uglier but faster." --The JavaPerformanceTuning.com team, Newsletter 039.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Passing request attributes when doing forward - redirect