You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by Minh Tran <Mi...@yamaha-motor.com> on 2001/09/28 21:13:07 UTC

RE: Is there any way in my Action class's perform method to get t he s ervlet context?

Kilmer,

try using the "servlet" instance version that comes with the action class
that you action extends from.. that class is the equivalent of the
controller.. which extends from HttpServlet.. where you can call
getServletContext() from.. so this is how you do it...

ServletContext myServletContext = servlet.getServletContext();


Good Luck,
Minh Tran

> -----Original Message-----
> From:	Kilmer, Erich [SMTP:Erich.Kilmer@mmt.bellhowell.com]
> Sent:	Friday, September 28, 2001 11:41 AM
> To:	'struts-user@jakarta.apache.org'
> Subject:	Is there any way in my Action class's perform method to get
> the s ervlet context?
> 
> Is there any way in my Action class's perform method to get the servlet
> context?
> From my perform method I call into some access beans that wrap an EJB
> layer.
> We have multiple web apps each with their own database, so the access
> beans
> needs a context to pass onto the EJB layer so that the proper data source
> is
> accessed.
> I can't seem to find a way to get servlet context from the request or the
> session. I can get it from the servlet config but I don't know how to
> access
> it in the Action perform.
> Anything in the AccessMap?
> Thanks for the help!
> Erich Kilmer
> Bell+Howell
> RTP, NC
>