What is a Container?

Servlets don’t have a main() method. They’re under the control of another Java application called a Container.

Tomcat is an example of a Container. When your web server application (like Apache) gets a request for a servlet (as opposed to, say, a plain old static HTML page), the server hands the request not to the servlet itself, but to the Container in which the servlet is deployed. It’s the Container that gives the servlet the HTTP request and response, and it’s the Container that calls the servlet’s methods (like doPost() or doGet()).

image with no caption
image with no caption
..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset