liveBook · Manning

Servlet

As explained in Spring Start Here, Second Edition

A servlet is a Java object whose methods interact with a servlet container to process HTTP requests and produce responses.

A servlet is a Java object that interacts directly with a servlet container. When the container receives an HTTP request, it calls a servlet method with the request; the servlet uses a response parameter to build the reply. The container translates between HTTP messages and Java objects and methods. section 7.1.3

Figure 7.7 The servlet container (Tomcat) registers multiple servlet instances. Each servlet is associated with a path. When the client sends a request, Tomcat calls a method of the servlet associated with the path the client requested. The servlet gets the values on the request and builds the response that Tomcat sends back to the client.

See how a container associates servlets with paths, calls the matching servlet for a request, and sends its response back to the client. section 7.1.3

How Spring Start Here, Second Edition covers it

How deep it goes
Defines container invocation and request-response parameters, but does not detail servlet implementation.
Examples
Uses Tomcat and path-associated servlet instances to illustrate request routing and response construction.
What it assumes
Defers detailed HTTP background to an appendix rather than requiring it here.
What you can do after
Understand how a servlet container routes an HTTP request to a servlet and returns its response.
How it connects
Connects servlets to HTTP, servlet containers, Tomcat, and Spring applications.

Also explained in

Compare how 2 books explain servlet →

Related concepts

This explainer was generated by Manning's knowledge graph from the text of Spring Start Here, Second Edition. The section links point to the parts of the book it draws on.