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 called servlet container?
How the typical servlet code look like ?
Why do we use sendredirect() method?
What is the use of java servlet api?
Name the different ways of session tracking.
what do you understand by url rewriting?
What do you mean by mime type?
When using servlets to build the HTML, you build a DOCTYPE line, why do you do that?
Describe some assignments that are executed by servlet container?
Whether we can get deadlock situation in servlets?
What is the inter-servlet communication?
How to handle exceptions thrown by application with another servlet?
When a client request is sent to the servlet container, how does the container choose which servlet to invoke?
Explain the differences between jsp and servlet.
What’s the difference between forward() and sendredirect() methods?