can i call destroy() method in init() method of servlet
Answer Posted / sunil jaiswal
Yes, we can call destroy method from init method without any worry. Destroy method will be called up as calling any other method. Request shall still be process afterwards through service method(doGet, doPost etc). Because calling destroy method doesnt mean the killing the servlet instance. Calling the init, service and destroy method is in the specification of servlet lifecycle. So we can not alter those specification through outside. Once the servlet container thinks the servlet is of no use at some time(at the server shutdown) the container surely will be calling up the destroy method prior to destroy the servlet instance.
| Is This Answer Correct ? | 10 Yes | 0 No |
Post New Answer View All Answers
How will two or three servlets interact or communicate with each other?
Explain url encoding in servlet?
How we can create war file in servlet?
What are its drawbacks of cgi?
What are session variable in servlets?
What are the exceptions thrown by servlets? Why?
Which event is fired at the time of project deployment and undeployment?
What is servlet in simple terms?
What is called a session?
What do you mean by deployment descriptor?
What do you mean by interservlet communication?
What do you mean by a filter and how does it work?
What is the use of welcome-file-list?
What are the drawbacks of cgi?
What is servlet instance?