You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by david chan <da...@yahoo.com> on 2003/03/18 22:02:52 UTC

Re: [OT] RE: how to get servletContext from httpsession ? (servlet ap i 2.2)

My problem is I have a class implements
HttpSessionBindingListener, then in method valueBound
and valueUnBound(HttpSessionBindingEvent se), I need
to access servletContext, but can't found a way to get
there.
I know from Action class/JSP/Servlet, I can get
servletContext.

What I trying to do is everytime a session expired or
invalidated, I need to do a clearup of this session
related data in a Hashtable stored in application
scope.

I already implemented in servlet api 2.3, but just
found out can't deploy to websphere 4.x because it
only supports api 2.2.

Thanks.
David


--- "Hajratwala, Nayan (N.)" <nh...@ford.com>
wrote:
> You can use HttpServlet.getServletContext()
> 
> ... or if you are in a jsp/tag,
> PageContext.getServletContext()
> 
> ---
> - Nayan Hajratwala
> - Chikli Consulting LLC
> - http://www.chikli.com
> 
> 
> -----Original Message-----
> From: david chan [mailto:david_tomcat@yahoo.com] 
> Sent: Tuesday, March 18, 2003 3:46 PM
> To: Struts Users Mailing List
> Subject: how to get servletContext from httpsession
> ? (servlet api 2.2)
> 
> 
> Hi,
>  My webapp use HttpSession.getServletContext()
> method
> and works fine on tomcat 4.x. but not in websphere
> 4.x.
> I just figure out HttpSession.getServletContext()
> method is only avilable on servlet api 2.3.
>  So in api 2.2, how can I do similar things? What I
> need is in valueBound(HttpSessionBindingEvent se)
> method to get an attribute from the application
> scope.
>  With api 2.3, this seems so easy, but api 2.2
> confuse
> me. 
>  
>  Thanks.
> David
> 
> __________________________________________________
> Do you Yahoo!?
> Yahoo! Platinum - Watch CBS' NCAA March Madness,
> live on your desktop!
> http://platinum.yahoo.com
> 
>
---------------------------------------------------------------------
> 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
> 


__________________________________________________
Do you Yahoo!?
Yahoo! Platinum - Watch CBS' NCAA March Madness, live on your desktop!
http://platinum.yahoo.com

---------------------------------------------------------------------
To unsubscribe, e-mail: struts-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: struts-user-help@jakarta.apache.org