aspose file tools
The moose likes Struts and the fly likes servlet context in struts Action class Big Moose Saloon
  Search | Java FAQ | Recent Topics
Register / Login


JavaRanch » Java Forums » Frameworks » Struts
Reply Bookmark "servlet context in struts Action class" Watch "servlet context in struts Action class" New topic
Author

servlet context in struts Action class

Anand Gondhiya
Ranch Hand

Joined: Feb 24, 2004
Posts: 155
Hello All,

in my struts-EJB application , I want to crate some application variables. For that I have to use servlet context right ?

How do I use servlet context in Struts Action classes ??

If this info is not enough , please let me know ..I will give more details.. thanks

-Anand.
Karthik Guru
Ranch Hand

Joined: Mar 06, 2001
Posts: 1209
did you try this in your aciton class:

getServlet().getServletContext()
somkiat puisungnoen
Ranch Hand

Joined: Jul 04, 2003
Posts: 1312
you can config in web.xml like this ::



How to use

ServletContext context = ....;
context.getAttribute("TEST1");


SCJA,SCJP,SCWCD,SCBCD,SCEA I
Java Developer, Thailand
Anand Gondhiya
Ranch Hand

Joined: Feb 24, 2004
Posts: 155
I used Servlet.getServletContext()......It works fine...now

Thanks all
 
I agree. Here's the link: http://zeroturnaround.com/jrebel - it saves me about five hours per week
 
subject: servlet context in struts Action class
 
Similar Threads
Accessing a servlet from a Struts App running in another context.
Use of Servlet Context?
Application attribute in struts 1
context and action classes
communicating ejb using struts.???