When the methods init() and Distroy() will be called?

Answers were Sorted based on User's Feedback



When the methods init() and Distroy() will be called?..

Answer / tulasi vani

The servlet life cycle included init() and destroy()(Small
d).

init() is called at the beginning of the servlet,it
performs certain one time activities which are required
during the lifetime of the servlet.It may be some
initialisation of variables or a database connection.

destroy() is called to destroy the servlet.Various
resources which are held by the servlet will be
released,database connections which were opened will be
closed.Later the servlet is destroyed.

Is This Answer Correct ?    4 Yes 0 No

When the methods init() and Distroy() will be called?..

Answer / abhijitbaji

both init() and destroy() are called only once.

init() at the begining when servlet object is cerated.
destroy() when the servlet object is removed from server(at
shoutdown).

service() is called each time when request comes to servlet.

Is This Answer Correct ?    2 Yes 1 No

Post New Answer

More Servlets Interview Questions

What is the difference between the include() and forward() methods?

0 Answers  


When the methods init() and Distroy() will be called?

2 Answers  


What is difference between GenericServlet and HttpServlet?

0 Answers  


Explain the working of service() method of a servlet.

0 Answers  


What is lazy loading and what is Generic Servlet Class?

0 Answers  






How the JSP file will be executed on the Server side?

0 Answers   Cap Gemini,


What are the features added in Servlet 2.5?

0 Answers  


How do cookies work in servlets?

0 Answers  


How to get the current httpsession object?

0 Answers  


How do you load an image in a Servlet?

0 Answers  


How to run a servlet program?

7 Answers   Infosys,


What is the difference between callling a RequestDispatcher using ServletRequest and ServletContext?

2 Answers  


Categories