The Servlet Environment

Servlets are Java classes that can be loaded dynamically and run by a Java-enabled Web server. The Web server provides support for servlets with extensions called servlet containers (also known as servlet engines).

Web clients (Web browsers) interact with the servlet using the HTTP request/response protocol that was described earlier.

Servlet Containers

The servlet container provides the following services and functionality:

  • The network services over which the requests and responses are sent.

  • Registers the servlet against one or more URLs.

  • Manages the servlet lifecycle.

  • Decodes MIME-based requests.

  • Constructs MIME-based responses.

  • Supports the HTTP protocol (it can also support other protocols).

A servlet container can also ...

Get Sams Teach Yourself J2EE™ in 21 Days, Second Edition now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.