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
Which java framework is most popular?
When jsessionid is created?
How can we include static files in the jsp page?
What is the web server used for running the Servlets?
How do you configure a centralized error handler in servlets?
What is the difference between Difference between doGet() and doPost()?
Which application server is best for java?
What are the exceptions thrown by servlets? Why?
What is servlet configuration?
If my browser does not support cookie, and my server sends a cookie instance what will happen?
How do cookies work in servlets?
How do you communicate in between Applets and Servlets?
What are the advantages of cookies?
How does tomcat servlet container work?
What are the servlet events?