When the methods init() and Distroy() will be called?
Answers were Sorted based on User's Feedback
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 |
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 |
Difference between GET and POST?
What are cookies and how will you use them?
what is the difference between ServletContext and ServletConfig
What are the phases of the servlet life cycle?
What's the difference between servlets and applets?
How is the get () method different from the post() method?
Hi friends am newbie to servlet. How code reusability easy in servlet. why not in jsp . here reusabillity means only javabeans or any thing else.
What is the capacity the doget can send to the server?
What is difference between Forward() and sendRedirect() methode?
How can I share objects across different sessions?
What do you mean by session tracking and also explain its techniques?
What are the objects involved when a servlet receives a call from client?