can i call destroy() method in init() method of servlet

Answer Posted / deepesh

Yes, We can call destroy() from init() method but after
coming out from the destroy() it will again process the init
() method like the life cycle has to be. Thus we can not
control the servlet life cycle, though we can call destroy
() from init().

Thanks.

Is This Answer Correct ?    2 Yes 0 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

How is the get () method different from the post() method?

537


What is the main purpose of java servlets?

587


What is meant by cookies?

612


What are the different mode that servlets can be used?

555


What is meant by servlet? What are the parameters of the service method?

578






What are some advantages of storing session state in cookies?

598


What are the annotations used in servlet 3?

578


Why do we have servlet filters?

603


If my browser does not support cookie, and my server sends a cookie instance what will happen?

654


What are the advantages of Servlet over CGI?

668


What’s the difference between genericservlet and httpservlet?

532


Why is a constructor needed in a servlet even if we use the init method?

608


If some new data has entered the database, explain how can a servlet refresh automatically?

739


Why doesn’t a servlet include main()? How does it work?

633


A client sends requests to two different web components. Both of the components access the session. Will they end up using the same session object or different session ?

612