This week's book giveaway is in the Jobs Discussion forum.
We're giving away four copies of Soft Skills and have John Sonmez on-line!
See this thread for details.
The moose likes Servlets and the fly likes servlet context without servlet Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Soft Skills this week in the Jobs Discussion forum!
JavaRanch » Java Forums » Java » Servlets
Bookmark "servlet context without servlet" Watch "servlet context without servlet" New topic
Author

servlet context without servlet

Anand Gondhiya
Ranch Hand

Joined: Feb 24, 2004
Posts: 155
Hi,
I am using startus and EJB with Weblogic 6.1.

Could anybody tell me how do I use "servlet context" in any class other than servlet ???

Thanks a lot
-Anand.
Sanjeev Kaushik
Ranch Hand

Joined: Aug 01, 2002
Posts: 105
ServletContext is an object, which is passed to Servlets by the Servlet Container. So source is servlets. I think you can try following ways.

You can pass servlet reference to the Class which is going to use ServletConext. Once servlet reference has come you get ServletContext also.

Another way is to implement ServletContextListener interface by this class. Whenever ServletContext is created this class will get notification and from the event ServletContextEvent you can get ServletContext.

Actual scenario is not clear to me, so I am just throwing ideas. But I think above ideas should be able to help you.


Sanjeev Kaushik
 
It is sorta covered in the JavaRanch Style Guide.
 
subject: servlet context without servlet