This week's book giveaways are in the JBoss and Spring forums.
We're giving away four copies each of JBoss AS 5 Development and Spring Dynamic Modules in Action and have the authors on-line!
See this thread and this one for details.
[Logo] JavaRanch » JavaRanch Saloon
  Search | FAQ | Recent Topics | Hot Topics
Register / Login


Win a copy of JBoss AS 5 Development this week in the JBoss forum
or Spring Dynamic Modules in Action in the Spring forum!
Reply Bookmark it! Watch this topic JavaRanch » Forums » Application Frameworks » Struts
 
RSS feed
 
New topic
Author

How to get ServletConfig and ServletContexts in Action class of struts

sreenivas rap
Ranch Hand

Joined: Jan 09, 2005
Messages: 109

HI,

How to get ServletConfig and ServletContext in Action class of struts.

so that i can use context object to store user sessions..

Help me out..

Thank You
J Sreenivas
Merrill Higginson
Ranch Hand

Joined: Feb 15, 2005
Messages: 4864

The class org.apache.struts.action.Action that your action class extends has a getServlet() method that returns the instance of ActionServlet that called your action. Once you have the servlet, you can get the servlet context. Example:

Merrill
Consultant, Sima Solutions
sreenivas rap
Ranch Hand

Joined: Jan 09, 2005
Messages: 109

Thanks merrill
 
 
 
Reply Bookmark it! Watch this topic JavaRanch » Forums » Application Frameworks » Struts
 
RSS feed
 
New topic
IntelliJ open source