Java Reference
In-Depth Information
time the file is requested, it is compiled into a servlet object and stored in memory and the out-
put is sent back to the requesting client. After the first request, the server checks to see whether
the *.jsp file has changed. If it has not changed, then the server invokes the previously com-
piled servlet object.
In this chapter and the next five chapters, we will be discussing how JSPs work and how to use
them. We will focus strictly on using JSPs as Views, as we discussed in Chapter 1, “Web
Applications and the Model View Controller (MVC) Design Pattern.” Figure 14.2 shows the
steps of a JSP request graphically.
1. The client requests a JSP
Web Server
2. The JSP engine compiles
the JSP into a servlet.
JSP Page
1. Request
Generated Servlet
4. Response
Compiled Servlet
3. The generated servlet is
compiled and loaded.
4. The compiled servlet services
the request and sends a response
back to the client.
F IGURE 14.2
The steps of a JSP request.
A key thing to remember about JSPs is that they are just servlets that are created
from a combination of HTML text and Java source code. This means that they contain
all the functionality of a normal servlet.
The Components of a JavaServer Page
In this section we cover the components that make up a JavaServer page. Each is discussed in
detail in the following sections.
Search WWH ::

Custom Search