My Experience Servlet And Its Life Cycle.


Yellow Belt
Servlet is a java program code that generates the HTML pages as output. They are the small program that execute on the server side and dynamically extends the functionality of web server.

Advantages of using Servlets:
  • Servlets are platform independent as they are written in java.
  • Sevlets are executed within the address space of webserver.
  • Full functionality of java class libraries are available to servlets.
Servlet life Cycle:
  • Browser first generates HTTP request for URL.
  • Request is then received by server and maps to the particular servlet.
  • Server then invoke init() of servlet.It is invoked to load servlet into the memory.
  • Server invokes the service() method of servlet to process the http request. It is invoked each time the browser requesr for service.
  • Finally the server may need to unload the servlet from memory which is done by using destroy() method.