You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by Nadja Senoucci <se...@21st.de> on 2003/06/06 12:24:34 UTC
Session
Hello,
I have a more Java than Struts related question but maybe you could answer
it as well? Okay, so I use a link to get to a form. In the ActionForward
that gets executed when the link is used, I load an object and stuff it into
the session. In my form I then want the fields tp be prepopulated with the
data from the object in the session. As I understand it that happens via the
get-methods of the ActionForm class for this form. My question is: How do I
read the object from the session before my get-methods are called? As I
understood so far, I need the HttpServletRequest object for that - which I
only have access to in the validate method (which doesn't help, since that's
already too late)... I know there must a simple way to do this, I just don't
know how...
Greetings,
Nadja
(P.S.: Dirk, I think, I accidently send my Thank-you-reply for the help with
my stupid parsing problem to your email address. I just hit reply and didn't
look at the address the email would be send to... Sorry about that.)
---------------------------------------------------------------------
To unsubscribe, e-mail: struts-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: struts-user-help@jakarta.apache.org
Re: Session
Posted by Dirk Markert <di...@dr-markert.de>.
Hallo Nadja,
see comments below.
***************************************************************
NS> Hello,
NS> I have a more Java than Struts related question but maybe you could answer
NS> it as well? Okay, so I use a link to get to a form. In the ActionForward
NS> that gets executed when the link is used, I load an object and stuff it into
NS> the session.
In think this happens in your action? Why dont you call the setters of
your form at this time?
NS> In my form I then want the fields tp be prepopulated with the
NS> data from the object in the session. As I understand it that happens via the
NS> get-methods of the ActionForm class for this form. My question is: How do I
NS> read the object from the session before my get-methods are called? As I
NS> understood so far, I need the HttpServletRequest object for that - which I
NS> only have access to in the validate method (which doesn't help, since that's
NS> already too late)... I know there must a simple way to do this, I just don't
NS> know how...
NS> Greetings,
NS> Nadja
NS> (P.S.: Dirk, I think, I accidently send my Thank-you-reply for the help with
NS> my stupid parsing problem to your email address. I just hit reply and didn't
NS> look at the address the email would be send to... Sorry about that.)
No problem
NS> ---------------------------------------------------------------------
NS> To unsubscribe, e-mail: struts-user-unsubscribe@jakarta.apache.org
NS> 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
Re: Session
Posted by Mark Lowe <ma...@talk21.com>.
In the refering action that puts your object in the session, populate
the form..
ActionForm theForm = (ActionForm) form;
Object yourObj = ...
String fooStr = yourObj.getSomething();
//for dynaforms
theForm.set("foo",fooStr);
or
//the method in your action form.
theForm.setFoo(fooStr);
//jsp
<html:text property="foo" />
there might be a more ninja way of doing this, but this is what i tend
to do...
hope this helps
mark
On Friday, Jun 6, 2003, at 11:24 Europe/London, Nadja Senoucci wrote:
> Hello,
>
> I have a more Java than Struts related question but maybe you could
> answer
> it as well? Okay, so I use a link to get to a form. In the
> ActionForward
> that gets executed when the link is used, I load an object and stuff
> it into
> the session. In my form I then want the fields tp be prepopulated with
> the
> data from the object in the session. As I understand it that happens
> via the
> get-methods of the ActionForm class for this form. My question is: How
> do I
> read the object from the session before my get-methods are called? As I
> understood so far, I need the HttpServletRequest object for that -
> which I
> only have access to in the validate method (which doesn't help, since
> that's
> already too late)... I know there must a simple way to do this, I just
> don't
> know how...
>
> Greetings,
> Nadja
>
> (P.S.: Dirk, I think, I accidently send my Thank-you-reply for the
> help with
> my stupid parsing problem to your email address. I just hit reply and
> didn't
> look at the address the email would be send to... Sorry about that.)
>
>
>
>
> ---------------------------------------------------------------------
> 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