0 votes
in Servlet by
What are the life-cycle methods for a servlet?

1 Answer

0 votes
by

Below are the life-cycle methods for a servlet

MethodDescription
public void init(ServletConfig config)It is invoked only once when first request comes for the servlet. It is used to initialize the servlet.
public void service(ServletRequest request,ServletResponse)throws ServletException,IOExceptionIt is invoked at each request.The service() method is used to service the request.
public void destroy()It is invoked only once when servlet is unloaded.
...