96 Self-Service Applications using IBM WebSphere V5.0 and IBM MQSeries Integrator
6.1 Application structure
The Self-Service Web application can be described as a set of interactions
between a Web browser and a Web application server. The interaction begins
with an initial request from the user’s Web browser for the welcome page of the
application. All subsequent interactions are initiated by the user by clicking a
button or a link, causing a request to be sent to the Web application server. The
Web application server processes the request, dynamically generates a results
page, and then sends it back to the client along with a set of buttons and links
that will generate the next request.
6.1.1 Model-View-Controller design pattern
One problem that is sometimes seen with large application development is that
the flow of the application is hard-wired in the presentation layer implementation
itself. This makes later application flow modifications and maintenance difficult
and expensive.
The Model-View-Controller design pattern divides the presentation layer from the
application flow and logic by dividing the application into three layers:
Model: the Model contains the core application functionality, both business
logic and data. The model is fully decoupled from the View or the Controller.
View: the View provides the presentation of the model, in other words, how
the application looks from a user’s point of view. The View can access the
Model information but should not make any changes to the Model directly.
Any change in the Model should be passed on to the View.
Controller: the Controller, as its name suggests, is responsible for the
application flow. It controls how the user’s input is translated into Model
interactions and how the Model is later presented to the user through the
View.
As shown in Figure 6-1 on page 97, the Model represents the application object
that implements the application data and business logic. The View is responsible
for formatting the application results and dynamic page construction. The
Controller is responsible for receiving the client request, invoking the appropriate
business logic and, based on the results, selecting the appropriate view to be
presented to the user.
A number of different types of skills and tools are required to implement various
parts of a Web application. For example, the skills and tools required to design
an HTML page are vastly different from the skills and tools required to design
and develop the business logic part of the application. In order to effectively
leverage these scarce resources and to promote reuse, we recommend