struts-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Mark Lepkowski <>
Subject Re: session form bean reuse
Date Mon, 02 Dec 2002 20:38:36 GMT
> > How do you get session A information available to session B without persisting it
somehow (the HttpSessionContext interface is depracated in Java Servlet API v2.1for security
> >
> Use servlet context attributes to share information between all the
> sessions in your webapp.

Thanks for the info.  I knew there had to be something in the servlet scope, but didn't know
quite where to find it.  The following works in any of our classes that extend Action:

servlet.getServletContext().setAttribute( "myAttribute", myAttribute );

and likewise

MyAttribute myAttribute = (MyAttribute)servlet.getServletContext().getAttribute( "myAttribute"

I noticed that:
- "servlet" is declared a protected "transient" ActionServlet in ActionServletWrapper, 
- ActionForm has the getter method for the wrapper,
- RequestUtils.populate() calls the getter,
- ActionServlet calls RequestUtils.populate()

What I don't follow is how the servlet object is exposed in the Action subclasses.

To unsubscribe, e-mail:   <>
For additional commands, e-mail: <>

View raw message