Servlet does not have a main() method, so the servlet is controlled by someone else, and this other person is the container ! Tomcat is a container.
The container
What can Tomcat ( container) do? 1. Communication support (communication bridge between servlet and WEB server) 2. Life cycle management (loading classes, instantiation, initialization, calling methods, destroying) 3. Multi-threading support 4. Declarative way to achieve security 5. JSP support ( Translate JSP to Java code)
When a servlet is deployed to a Tomcat container, a fairly simple XML document (web.xml) is created, which is called a deployment descriptor.
The deployment