JEE : Java Server Page (JSP) life cycle

All the JSP run under supervising of web server. They do not receive requests from client and they do not send the response to client. All the JSP pages pass through the Server side processing. And result of sever side processing is sent to client. That is why they called dynamic pages. In the case of static page there is no server processing, web server returns them as they are.
Life Cycle
Dotted line showing that, When client sends the request for static page , server returns the requested page without processing and solid line showing that when client sends the request for dynamic page, server process it and the response generated is returned to client.
Life Cycle Steps
How the JSP executes
1. A request for a JSP pages is made by the client.
2. The request is handled by the web server.
3. Then the request is delegated to the JSP container
4. Container will check whether JSP to be invoked is changed or not
5. If there are some changes or its new JSP page then engine translates the contents of a JSP into its implementation servlet
6. Otherwise already implemented servlet is used by container.
7. Then container uses the service method of servlet to process the request of client.
Execution path for jsp pages
From the above figure we can see that there are to phase associated with the JSP, one is translation, compilation and execution.
  • The translation phase may be omitted if the servlet generated for a particular JSP is not older then that JSP.
  • Compilation phase also depends on the translation phase.
  • The execution phase always exists. The generated servlet is executed each time whenever the request is made by the client.

No comments:

Popular Posts