topbella

Thursday 3 January 2013

Servlet Life Cycle



There have three phases which are initialization, service and destruction.



Phases
Explanation
Initialization
(happen only one) When a container loads, a servlet it invokes the init() before servicing any request
Service Client Request
Server invokes service() method to do request and response
Destruction
(happen only one) When servlet going to remove the memory, it invoke the method destroy()




Advantages of servlet

          Multithreaded
        Request received by servlet container is loaded into memory and assign thread
        New thread of the same servlet is created if more request for the same servlet is received
        make the overall processing faster
          Stable environment and easy to deploy since servlet is executed inside a container
          Inherit all good features of the java programming language

0 comments:

Post a Comment