• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Servlet Context

 
MInu
Ranch Hand
Posts: 517
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi...

What are the methods to obtain servlet context?

Thanks
 
Ranjit Jana
Ranch Hand
Posts: 30
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi ,

I have made a note , I think from the earlier messages.
You can browse through some earlier messages too and find same answer(not sure though)

The answer for your question.

1.ServletConfig.getServletContext

2. GenericServlet implements ServletConfig so contains a method getServletContext

3. In a filter you have access to FilterConfig which is set in init(FilterConfig) callback . use FilterConfig.getServletContext()

4. In a ServletContextListener or ServletContextAttributeListner the event passed to listener has a getServletContext()


In case you find some more ways of getting the Servlet context . Post a reply adding your comment.

Ranajit
 
P. Dunn
Ranch Hand
Posts: 34
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Originally posted by minu su:
Hi...

What are the methods to obtain servlet context?

Thanks


ServletContextAttributeEvent.getServletContext()
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic