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 servlet configuration?

0 Answers  


what is the difference between?when we write the code in following manner? class One extends httpservlet { } and class One extends genericservlet { }

4 Answers  


Explain Servlet Chaining ?

2 Answers  


What are the advantages of cookies?

0 Answers  


How will two or three servlets interact or communicate with each other?

0 Answers  






Differentiate between the print writer and servlet output stream?

0 Answers  


Which method is called when reference variable is passed in system.net?

0 Answers   HCL,


What is Servlets and explain the advantages of Servlet life cycle?

0 Answers  


What is called Session Tracking?

0 Answers  


How do you deal property files in servlet?

0 Answers  


How can you push data from an Applet to a Servlet?

0 Answers  


Explain the methods of request dispatcher in servlet?

0 Answers  


Categories