Write all the phases defined in Servlet Life Cycle?

devquora
devquora

Posted On: Feb 22, 2018

 

There are main four phases required in Servet Life Cycle. These are:

  1. Servlet class Loading: On a client request of a servlet, the container first loads the class in the memory and after that calls its default no argument constructor.
  2. Servlet Class Initialization: After the first phase of loading class in memory, container initiates the ServletContext object and then invokes the Init method by passing servlet Config for the servlet. This phase transforms the normal class to a servlet.
  3. Request Handling: It is the phase where a servlet is ready to handle the requests. For each client request, it invokes the method service () by passing request and response object reference.
  4. Removal from service: when the process stops, the container calls the destroy () method and destroy the servlet.

    Related Questions

    Please Login or Register to leave a response.

    Related Questions

    Servlet interview questions

    What do you mean by Servlet?

    It is designed by the Java software company. It is used to extend the ability of the server...

    Servlet interview questions

    Differentiate between the web server and application server?

    Web Server is the connection between the HTTP and HTML...

    Servlet interview questions

    Which HTTP method is said to be non-idempotent and idempotent?

    If any HTTP brings the same result every time then it means it is idempotent...