Saturday, 5 September 2015

What are life cycle methods of a servlet?

Servlet Life Cycle consists of three methods:
  1. public void init(ServletConfig config) – This method is used by container to initialize the servlet, this method is invoked only once in the lifecycle of servlet.
  2. public void service(ServletRequest request, ServletResponse response) – This method is called once for every request, container can’t invoke service() method until unless init() method is executed.
  3. public void destroy() – This method is invoked once when servlet is unloaded from memory.

No comments:

Post a Comment