Pages

Friday, January 1, 2010

Servlet Life Cycle

The life cycle of a servlet is controlled by the container in which the servlet has been deployed.
When a request is mapped to a servlet, the container performs the following steps.
1. If an instance of the servlet does not exist, the web container
a. Loads the servlet class.
b. Creates an instance of the servlet class.
c. Initializes the servlet instance by calling the init method.
2. Invokes the service method, passing request and response objects.
If the container needs to remove the servlet, it finalizes the servlet by calling the servlet’s
destroy method.

No comments:

Post a Comment