dcsimg
How to get the ServletContext object from within the Action subclass.
1 posts in topic
Flat View  Flat View
TOPIC ACTIONS:
 

Posted By:   b_wong
Posted On:   Sunday, October 9, 2005 11:26 AM

Hi,

I am using struts/tomcat. Within my LoginAction class (subclass of Action), I need to get at the ServletContext object, is there a way to do it?

I have an InitServlet that reads in properties from a properties file when the webapp starts up. I would like to pass some of those properties to my LoginAction class.

Thanks

Re: How to get the ServletContext object from within the Action subclass.

Posted By:   Anonymous  
Posted On:   Monday, October 10, 2005 09:17 AM

The ActionServlet is a protected field within the Action object.



This means you can access the ServletContext by using the following statement within any Action subclass:



servlet.getServletContext();



:) Have a good one.
About | Sitemap | Contact