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 |
How can you maintain servlet chaining?
What is the difference between forward () and sendredirect () functions in servlet? Explain
What is called a session?
What are the ways to handle multi-threading in servlets?
When Servlet is unloaded?
What is a parser. What does a parser do with a XML? Why do we need it?
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 ?
how many jsp scripting elements are there and what are those?
Which java framework is most popular?
What if we pass negative value in load-on-startup?
How is a servlet implemented in code?
What do you mean by web applications? Explain web application directory arrangement?