When will container destroy the Servlet?


–          Stop all the requests to this Servlet.

–          Wait till the existing request to this Servlet get complete.

–          Call the destroy() mehod of the Servlet After this the Servlet is no more there in the Container.

                    The Servlet is destroyed by the container following the above process only when the application is undeployed.

What are the lifecycle methods of Servlet?


The following 3 methods are the Servlet lifecycle Methods

1.  public void init(ServletConfig config)

                           throws ServletException

2.  public void service(ServletRequest req,

                              ServletResponse res)

                              throws ServletException,

                                     java.io.IOException

3.  public void destroy()