03 - JSP Architecture

3.1 Overview

In previous chapter we installed Apache Tomcat server because tomcat has a JSP engine which is required to process jsp page. In this chapter we will discuss the flow of  JSP request and response.

3.2 Architecture of JSP

A typical request / response phase of a JSP is defined below

a) Request is initiated for a jsp file by client using browser

b) Webs server (JSP engine) loads the JSP file and translate the JSP file generate a java code . Generated Java code will be a Servlet.

c) Once Servlet (Java code ) is generated, JSP engine compiles the servlet. Any compilation errors will be detected in this phase.

d) Now servlet class is loaded by the container and executes it.

e) Engine sends the response back to client.

Translation and compilation phase is done only when

a) first request came for the jsp file

b) the generated servlet is older than the JSP file. This is the case when JSP file is modified

Refer below diagram for pictorial representation :

Like us on Facebook