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 do you mean by default initialization in java servlet?
Write a simple servlet program to print the contents of html.
Whether we can get deadlock situation in servlets?
What do you mean by the servlet chaining?
What is the life cycle of a servlet?
What is a servlet?
What are the different methods involved in the process of session management in servlets?
How can you run a servlet program?
How do you invoke a servelt?
Difference between forward() method and sendredirect() method ?
What is the use of httpservletrequestwrapper?
What are the mechanisms used by a servlet container for maintaining session information?
What’s the difference between genericservlet and httpservlet?
How httpservlet is different from the genericservlet?
Does servlet have main method?