context root. A Java EE web.xml file can contain many additional XML tags. Besides mapping URLs
to actual servlets, you can use the deployment descriptor to customize other aspects of your web
application such as security roles, error pages, tag libraries, and initial configuration information.
However, these additional tags are not needed for this helloworld application. The web container
loads the HelloWorld servlet class and instantiates it. Only a single instance of the HelloWorld servlet
is created, and concurrent requests to the HelloWorld servlet are executed on that same instance.
Every client request generates a new pair of request and response objects. The container runs
multiple threads to process multiple requests to a single instance of the HelloWorld servlet.
Note In a distributed web app, there is one instance of a particular servlet per JVM, but each JVM still has
only a single instance of that servlet.
The Life-Cycle Methods
The life cycle of an object describes the sequence of steps an object must go through during its
existence. The life of a servlet is different from a normal Java class because a servlet has to execute
inside the web container. Figure 2-16 shows the hierarchy of the HelloWorld servlet .
Figure 2-16. Hierarchy of HelloWorld servlet