As with a normal page, your browser sends an HTTP request to the web server.
The web server recognized that the HTTP request is for a JSP page and forwards it to a JSP engine.
The JSP engine loads the JSP page from disk and converts it into a servlet content.
The JSP engine compiles the servlet into an executable class and forwards the original request to a servlet engine.
A part of the web server called servlet engine loads the servlet class and executes it. During execution, the servlet produces an output in HTML format, which the servlet engine passes to the web server inside an HTTP response.
The web server forwards the HTTP response to your browser in terms of static HTML content.
Finally web browser (client) handles the dynamically generated HTML page inside the HTTP response exactly as if it were a static page.
Typically, the JSP engine checks to see whether a servlet for a JSP file alreadly exists and whether the modification date on the JSP is older than the servlet. If the JSP is older than its generated servlet, the JSP container assumes that the JSP hasn’t changed –> the generated servlet still matches the JSP’s contents. This makes the process more efficient than other scripting languages (such as PHP) and therefore faster.
So in a way, a JSP page is really just another way to write servlet without having to be a Java programming wiz. Except for the translation phrase, a JSP page is handled exactly like a regular servlet.
Leave a Comment