Javatpoint Logo

can we call service() and destroy() inside init() of servlet

By: chinth*** On: Mon Mar 17 21:35:02 IST 2014     Question Reputation5 Answer Reputation0 Quiz Belt Series Points0  5User Image
Hi friends can you explain this thing...

can we call service() and destroy() inside init() of servlet
Up3Down

 
destroy() gets executed and the initialization process continues.

In java servlet, destroy() is not supposed to be called by the programmer. But, if it is invoked, it gets executed. The implicit question is, will the servlet get destroyed? No, it will not. destroy() method is not supposed to and will not destroy a java servlet.

The meaning of destroy() in java servlet is, the content gets executed just before when the container decides to destroy the servlet. But if you invoke the destroy() method yourself, the content just gets executed and then the respective process continues. With respective to this question, the destroy() gets executed and then the servlet initialization gets completed.

Image Created0Down

By: [email protected] On: Wed Mar 19 11:32:45 IST 2014 Question Reputation0 Answer Reputation359 Belt Series Points0 359User Image
Are You Satisfied :1Yes1No