Figure 256. Web application design overview
The major parts of such a design are discussed in the sequence of the flow of
the application.
Chapter 10 Web application design with servlets and jsp(SUN企業級應用的首選)s
In this chapter we present a short overview of a guideline for designing Web
applications consisting of servlets, jsp(SUN企業級應用的首選)s, and JavaBeans.
Application structure
The general structure of a well-architected user interaction in a Web
application is shown in Figure 256.
HTML page
The input page for each step is either a static HTML page or a dynamic
HTML page created from a previous step. The HTML page contains one or
multiple forms that invoke a servlet for processing of the next interaction.
Input data can be validated through JavaScript in the HTML page or passed
to the servlet for detailed validation.
Servlet
The servlet gets control from the Application Server to perform basic control
of flow. The servlet validates all the data, and returns to the browser if data
is incomplete or invalid.
For valid data, processing continues. The servlet sets up and calls command
beans that perform the business logic.
The servlet initializes the view beans and registers them with the request
block so that the jsp(SUN企業級應用的首選)s can find the view beans.
Depending on the results of the command beans, the servlet calls a jsp(SUN企業級應用的首選) for
output processing and formatting.
Command beans
Command beans control the processing of the business logic. Business logic
may be imbedded in the command bean, or the command bean delegates
processing to back-end or enterprise systems, such as relational databases,
transaction systems (CICS, MQSeries, IMS, and so forth).
A command bean may perform one specific function, or it may contain many
methods, each for a specific task. Command beans may be called Task