What is a Servlet Context?

Alex Chaffee

A Servlet Context is a grouping under which related servlets (and JSPs and other web resources) run. They can share data, URL namespace, and other resources. There can be multiple contexts in a single servlet container.

The ServletContext object is used by an individual servlet to "call back" and obtain services from the container (such as a request dispatcher). Read the JavaDoc for javax.servlet.ServletContext for more information.

You can maintain "application global" variables by using Servlet Context Attributes.

Since Servlet spec 2.1, a servlet context is more-or-less equivalent to a web application ("webapp").