You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by Holger Wiechert <hw...@iks-gmbh.com> on 2001/07/18 20:10:05 UTC

AW: getSession in xxxForm

HI,
I'm having the same problem (and saw this posting right after I've put mine in).
Yes, getting the ActionServlet let's me access the ServletContext, but then I'm even
further away from getting the request that caused the ActionForm to be created, or do I see this wrong?

Well, I guess, that I could do something like: having always a different ActionMapping "in front"
of the one, where the ActionForm will be created. Within this pre-executed Action I use the same Form
(and have access to the request), change the Form according to the request and forward it to  the
real Action (just the first idea I had).

But isn't there a way of accessing the request somhow directly from within the constructor of the Form?

Holger



-----Ursprungliche Nachricht-----
Von: Rajan Gupta [mailto:rgupta99_1999@yahoo.com]
Gesendet: Mittwoch, 18. Juli 2001 16:13
An: struts-user@jakarta.apache.org; stefan.faist@hmi-informatik.de
Betreff: Re: getSession in xxxForm 


You have access to ActionServlet as a protected attribute in ActionForm.
do a getServletContext() on the instance & you are on your way 
--- Stefan Faist <st...@hmi-informatik.de> wrote:
> Hello All,
> I have set an attribute into a session: "session.setAttribute("id",
> xxxForm.getId());"
> Now I want to get this attribute in a xxxForm:
> "session.getAttribute("id");". But I have no HttpRequest object.
> 
> How can I get the session in the xxxForm?
> Can someone help me?
> 
> Stefan
> ----------------------------------------------
> hmi-Informatik GmbH
> Zettachring 6 - D-70567 Stuttgart
> E-Mail: stefan.faist@hmi-informatik.de
> http://www.hmi-informatik.de
> 


__________________________________________________
Do You Yahoo!?
Get personalized email addresses from Yahoo! Mail
http://personal.mail.yahoo.com/