JSP Life Cycle

JSP Life Cycle :JSP never outputs the content directly to the browser. Instead, JSP relies on initial server-side processing process which translates JSP page into the JSP Page class. The page class then will handle all the requests made of JSP. A JSP page is first converted into a Servlet and then that Servlet gets compiled and executed like any other Servlet. The translation of a JSP page into the corresponding Servlet is done by the JSP Engine of the underlying Web Container. The JSP life cycle is described in figure 1 & 2:

The entire life cycle of a typical JSP page can be summarized as the following phases

  • Translation
  • Compilation
  • Class loading
  • Initialization
  • Execution
  • Service()
  • Finalization
  • Destroy

When a web container receives a jsp request (may be first or subsequent), it checks for the jsp’s servlet instance. If no servlet instance is available or if it is older than the jsp, then, the web container creates the servlet instance using above mentioned stages.

 

Leave a Reply

Your email address will not be published. Required fields are marked *