How the server will know (i.e) when it can invoke init, service,destroy methods of servlet life cycle?

Showing Answers 1 - 3 of 3 Answers

adevibala

  • Sep 20th, 2005
 

when a request for a servlet is made the container will check for the servlet instance 1. If an instance of the servlet does not exist, the web container 1. Loads the servlet class. 2. Creates an instance of the servlet class. 3. Initializes the servlet instance by calling the init() method. 2. Invokes the service() method, passing request and response objects. 3. If the container needs to remove the servlet, it finalizes the servlet by calling the servlet's destroy() method.

Saffy

  • Oct 16th, 2005
 

init() method acts like a contructor, it is initilized when servlet is loaded.service() method is first executed when servlets service is started.Note: service() method is override implicitly for HTTP servlets, and should be overridden explicitly for Generic Servlets.destroy() method is called any where in servlet or server call this method while terminating servlet.

  Was this answer useful?  Yes

diptendu gorai

  • Dec 22nd, 2005
 

very good side

  Was this answer useful?  Yes

Give your answer:

If you think the above answer is not correct, Please select a reason and add your answer below.

 

Related Answered Questions

 

Related Open Questions