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 would you create deadlock on your servlet?
Explain servlet events?
How we can call a jsp from the servlet?
Tell the new features added in servletrequest interface i.e. Servlet 2.4
How to get the actual path of servlet in server?
What are the servlet events?
What do you mean by default initialization in java servlet?
What are the phases of the servlet life cycle?
What is called a session?
What is the main purpose of java servlets?
What is life cycle of Servlet?
What do you understand by mime type?
What is servlet name in web xml?
What is the capacity the doget can send to the server?
Explain the difference between generic servlet and http servlet?