Previous | Home | Next |
Life cycle of Servlets
- Loading Servlet Class : It is loaded which is first request for the servlet is received by the Web Container.
- Servlet instance creation :After this is loaded, Web Container creates a instance of it and it is created only once in the life cycle.
- Call to the init() method : init() method is called by the Web Container on servlet instance to initialize the servlet. Signature of init() method :
- Call to the service() method : In containers call the service() method to response servlet is received. This service() method to call the doGet() or doPost() methos based ont eh type of the HTTP request, as explained in previous lessons. Signature of service() method :
- Call to destroy() method: In this method to call web Container to destroy() or removing servlet instance.
public void init(ServletConfig config) throws ServletException
public void service(ServletRequest request, ServletResponse response) throws ServletException, IOException
Previous | Home | Next |