Please explain the lifecycle of a JSP page in detail.

Ryan Breidenbach

This is the typical life cycle for a JSP page:

  • Before a JSP is accessed for the first time, it exists as it was originally created, as a .jsp file.
  • When a request is first made for the JSP, it it translated into .java file. This file represents a servlet class with all the JSP tags and scriplets converted to corresponding Java code.
  • This .java is then compiled into a .class file for the servlet container to use.
  • From this point on, it enters the life cycle of a servlet.
The one thing to note is that some servet/JSP containers provide the capability to auto-reload newer versions of JSPs. That is, each time a request for a JSP is made, the servlet container checks the time stamp of the .jsp file and its corresponding .class file. If the .jsp is newer, the JSP starts over at step one in its life cycle.
0 Comments  (click to add your comment)
Comment and Contribute






(Maximum characters: 1200). You have 1200 characters left.



About | Sitemap | Contact