Number Of Page View:100,000+/Months
LOGIN |New User


What are the different ways for getting a servlet context?
The different ways for getting a servlet context :

  * ServletConfig.getServletContext()
  * GenericServlet implements ServletConfig, so HttpServlets all have a getServletContext() method
  * In a Filter you have access to the FilterConfig which is set in the init(FilterConfig fc) callback. You can use FilterConfig.getServletContext().
  * In a ServletContextListener or a ServletContextAttributeListener, the event passed to the listener methods has a getServletContext() method.