21 Feb 2014

Servlet Life Cycle

Servlet Life Cycle With Diagram And Description


Servlet Life Cycle Methods

  • init( )
  • Service( )
    • doGet( )
    • doPost( )
    • doXxx( )
  • destroy( )


When the servlet is first created, its init() method is invoked, so init() is where you put one-time setup code. After this, each user request results in a thread that calls the service() method of the previously created instance. Multiple concurrent requests normally result in multiple threads calling service simultaneously, although your servlet can implement a special interface (SingleThreadModel) that stipulates that only a single thread is permitted to run at any one time. The service method then calls doGet(), doPost(), or another doXxx() method, depending on the type of HTTP request it received. Finally, if the server decides to unload a servlet, it first calls the servlet's destroy method.




Written by

Hello,Visitor..!

0 comments:

Comments

© 2013-2016 ITTechnocrates. All rights resevered. Developed by Bhavya Mehta