0  0 2015-09-24 10:39:30

All the servlet implements the javax.servlet. Servlet interface. This interface has the servlet lifecycle methods. The interface is defined as follows:


The web server loads a servlet when it is first requested by a client and manage the lifecycle of the servlet. Three methods are important in the servlet lifecycle.

  • Init( )

When a server loads a servlet, it calls the servlet’s init methods to initialize the servlet. The init method is called only once.

  • Service( )

After the server loads and initializes the server, the servlet is able to handle client requests. It processes them in its service method. Each client request generate service methods.

  • Destroy( )

This method is called by web server to end the servlet. This method is called only once but it must be thread safe (because other thread may be running). It perform garbage collector.

Comments (0)

Post Your Comments


Hong Kong Office

Find Us On

Website Development Company
Digital Marketing
website development company in Hong Kong
website designer in pune