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 printwriter is different from servletoutputstream?
What is servlet in simple terms?
What do you mean by url pattern in servlet?
Why is httpservlet declared abstract?
When a client request is sent to the servlet container, how does the container choose which servlet to invoke?
What is the life-cycle of servlets?
What is generic servlet class?
What is the servlet?
What are the differences between the servletconfig interface and the servletcontext interface?
What is the life cycle of a servlet?
Is servlet a server side scripting language?
What do you mean by mime type?
Explain servlet life cycle?
What are the different session tracking techniques?
How to get the IP address of client in servlet?