What is ServletContext | Eklavya Online

What is ServletContext

  • ServletContextInterface defines methods that a servlet can use to communicate to the Container.
  • ServletContext Parameters are specified for entire application and are available for all servlets.
  • ServletContext is also calledapplication object.
  • ServletContext is used to obtain information about environment on which a servlet is running.
  • There is one instance object of the ServletContext interface associated with each Web application deployed into a container.
  • In cases where the container is distributed over many virtual machines, a Web application will have an instance of the ServletContext for each JVM.
  • Servlet Context is a grouping under which related servlets run. They can share data, URL namespace, and other resources. There can be multiple contexts in a single servlet container.