You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by cn...@rayc.brevsville.com.au on 2004/02/16 06:26:59 UTC
Re: Can I access an ActionForm JavaBean with a session scope?
You don;t use the name quoted you place the Object in the session and then
retrieve it by name.
session.setAttribute(yourbean,"the name you give it");
Object mybean = session.getAtribute("the name you give it");
I think you have to cast myObject cos it is untyped.
Chris
On Sun, 15 Feb 2004, Gregg Williams wrote:
> I am continuing work on an extremely simple (2 web pages) Struts
> application. In the first page (entryPage.jsp), you enter data into a form
> and click the submit button. This takes you to the second page
> (displayPage.jsp), which displays the data from the form; and clicking the
> submit button on this page takes you back to the first page--very simple.
>
> The first page uses an form-bean named entryForm, which has a session scope
> and and two parameters, name and address. Similarly, the second page has an
> form-bean named displayForm.
>
> Here's my question. While I'm processing the second page, I want to change
> a value in the entryForm JavaBean. Since it has a session scope, can I
> access it through the session variable--i.e. something like:
>
> HttpSession session = request.getSession();
> session.setAttribute("entryForm.name", "new-name-here");
>
> But I can't seem to get this to work. I have searched over the Internet
> (which includes the archives of this mailing list) but haven't found
> anything. Any suggestions? Thanks.
>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: struts-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: struts-user-help@jakarta.apache.org
>
---------------------------------------------------------------------
To unsubscribe, e-mail: struts-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: struts-user-help@jakarta.apache.org