• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other all forums
this forum made possible by our volunteer staff, including ...
  • Campbell Ritchie
  • Paul Clapham
  • Ron McLeod
  • Bear Bibeault
  • Liutauras Vilda
  • Jeanne Boyarsky
  • Junilu Lacar
  • Henry Wong
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Jj Roberts
  • Tim Holloway
  • Piet Souris
  • Himai Minh
  • Carey Brown
  • salvin francis

servlet context without servlet

Ranch Hand
Posts: 155
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Ranch Hand
Posts: 105
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
    Bookmark Topic Watch Topic
  • New Topic