JSP lifecycle

jsp page will participate in translation phase in the following cases:

  1. At the time of first request
  2. If the source code of the jsp got modified when compared with earlier request.
  3. For this,jsp engine uses “ARAXIS” tool_to compare time stamps of .jsp and .class file.
  4. .class file time stamp should be recent.
  5. While performing translation or compilation, if any problem occurs then we will get Http status500(Http500)

Pre compilation of JSP

  1. Usually translation phase of jsp will be performed at the time of first request.
  2. We can initiate translation phase explicitly by pre compilation process. we can initiate pre-compilation by using request Parameter “jsp-precompile.”
  3. We can send the request for pre initialization of jsp as follows
  4. http://localhost:9091/WebApp/sample.jsp?jsp-precompile=true

  5. This is not a request to the jsp,This is the request for execution until jspInit() method.
  6. http://localhost:9091/WebApp/sample.jsp

The main advantage of jsp preCompilation are

  • All requests are processed with uniform response time
  • We can fix translation time and compile time problems before processing any request.