Java Reference
In-Depth Information
Command
JSP
Servlet
Client
HTML
Figure 3.6 The completed Triangle design pattern. This is a modified form of Model-View-
Controller. Because this technology is batch oriented, we have two views. The Client HTML is
the input view, and the JSP is the output view.
existing
HTML
tags. The
JSP
is then compiled and executed on the server. The
output of the executed
JSP
is a page of
HTML
. This
HTML
page is then
returned to the client.
This architecture offers many advantages:
JSP
s allow dynamic content.
Since
HTML
scripts like JavaScript execute on
the client, dynamic content that exists on the server is not available. Since
the
JSP
is compiled and run on the server, it is not limited like JavaScript.
Separation of concerns.
JSP
s can be created and maintained in an editor.
Many editors explicitly accept
JSP
tags and extensions. Almost all
HTML
editors allow
HTML
tags to be passed through. Using this design, a
graphics designer can be deployed to build web pages even if dynamic
content is involved with a minimum amount of scripting.
JSP
s can be used to isolate the view from the controller and the model.
This
advantage is academic, but since it applies to one of the oldest and most
studied design pattern in modern history, it cannot be ignored. Years of
practical experience have shown that the Model-View-Controller design
pattern has improved readability, increased reliability, and reduced the
disadvantages of change.
JSP
s are an open standard.
Unlike many techniques for creating dynamic
content,
JSP
s are based on collaborative standards. All of the techniques
in this topic are compatible with
JSP
designs.
JSP
s permit connection
pooling, are compiled to long-running servlets, and handle dynamic
content without the need of a full applet on the client.