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
What is servletconfig?
Explain the difference between generic servlet and http servlet?
What are the two important api's in for servlets?
When servlet object is created?
What is Request Dispatcher?
When a client request is sent to the servlet container, how does the container choose which servlet to invoke?
What are different Authentication options available in Servlets.
Which http method is said to be non-idempotent and idempotent?
How can an existing session be invalidated?
How do you communicate in between Applets and Servlets?
What are the uses of servlet and what is servlet chaining?
What is the difference between the http servlet and generic servlet?
What is servlet used for?
What is the use of servlet context?
Explain the steps involved in placing a servlet within a package?