![]() 57
2.3.9 JavaServer Pages (JSP)
JSP
is a presentation-centric,
server-side
component
designed
to
work
within
a
request/response processing
model, similar to Servlet. It
let
you put
Servlet Code
or
any
valid
Java
code
directly
into
an
HTML
page.
Normally
JSP
has
a
.jsp extension,
and
typically
install
it
in
the
root
directory
of
your
web
application.
Figure
below
shows
an
interaction between web browser and JSP by sending HTTP Request and receiving HTTP
Response.
Browser
HTTP
Request
Web Server
JSP
HTTP
Response
Figure 2. 25
Interaction between Browser and Web Server
(Source: Budiono, Tri. 2004. CS335 Web Programming)
A JSP file is actually a Java servlet. It is nothing more than another way to view a
servlet. The concept of a JSP
file
is
to allow
us to
see a Java servlet as an HTML page.
This
view
eliminates
all
of
the
ugly
print()
statements
that
normally
show
up
in
Java
code.
According
to
Marty
[1],
JSP
technology
enables
you
to
mix
regular,
static
HTML
with dynamically generated content from servlet. In JSP pages, you simply write the code
|