Patil, Sheetal wrote:
As I know u cant access this object
Better way put it in session scope or regenerate it
Else see if you can hidden property in jsp
Correct. Just to expand on it a bit for Puneet... the request that you
set the attribute on is the request for resultsPage.jsp. That is the
final resource the server returns for that request. Once it is
returned, that request is destroyed. A link on that page represents a
whole new request, hence your object is not present in it.
You can set it your object in session as stated, which would make it
available to any request made within that session. That's about the
easiest answer.
Alternatively, if you serialize it in some way, you can put that value
in a hidden form field as suggested. Then, when that form is submitted,
you will be able to reconstitute the object. I'm pretty sure the
built-in object serialization mechanism will not work here thought
because it generates a binary representation of the object, and hence
may not be representable as a textual form value. But, you can write
your own serialization implementation that generates just plain text,
then just have a static reconstitute() method on your object that
returns a new object with the values set. Same basic thing.
Frank
--
Frank W. Zammetti
Founder and Chief Software Architect
Omnytex Technologies
http://www.omnytex.com
AIM/Yahoo: fzammetti
MSN: [EMAIL PROTECTED]
Author of "Practical Ajax Projects With Java Technology"
(2006, Apress, ISBN 1-59059-695-1)
Java Web Parts - http://javawebparts.sourceforge.net
Supplying the wheel, so you don't have to reinvent it!
-----Original Message-----
From: Puneet Lakhina [mailto:[EMAIL PROTECTED]
Sent: Friday, July 28, 2006 5:19 PM
To: user@struts.apache.org
Subject: Bean Scope Problem
Hi,
I have an action that creates an attribute like this
request.setAttribute("results", resultObject);
Now this action then forwards to a page (say resultsPage.jsp) which does
some processing with this object.
This resultsPage then has links that calls another page(say
otherPage.jsp)
Now iam trying to use this results object in otherPage.jsp. but it
returns null.
Object results = request.getAttribute("results");
i.e. the results Object mentioned above is null.
Do i need to do anything with the scope of the bean.
Or am i accessing it in an incorrect way?
I am using <html:link> tags to create links from resultsPage.jsp
--
Puneet
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]