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 session variable in servlets?

1 Answers  


What are advantages of servlets over cgi?

0 Answers  


Explain the difference between get and post method in servlet?

0 Answers  


Explain the concept of ssi ?

0 Answers  


What is servlet api used for conneting database?

0 Answers  






Explain Action Servlet?

0 Answers   Cap Gemini,


Write a servlet to upload file on server.

0 Answers  


Explain servlet life cycle?

0 Answers  


Name the packages that work with servlet?

0 Answers  


What do you mean by session tracking?

0 Answers  


Why are servlets used?

0 Answers  


What is difference between PrintWriter and ServletOutputStream?

0 Answers  


Categories