Servlet life cycle

1 answer

Answer

1226121

2026-02-15 02:15

+ Follow

Java
Java

The Javax.servlet.Servlet interface defines the three methods known as life-cycle method.

public void init(ServletConfig config) throws ServletException

public void service( ServletRequest req, ServletResponse res) throws ServletException, IOException

public void destroy()

First the servlet is constructed, then initialized wih the init() method.

Any request from client are handled initially by the service() method before delegating to the doXxx() methods in the case of HttpServlet.

There are two more methods.....

public abstract String getServletInfo()

public abstract ServletConfig getServletConfig()

ReportLike(0ShareFavorite

Copyright © 2026 eLLeNow.com All Rights Reserved.