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 users input is translated into Model
interactions and how the Model is later presented to the user through the
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
Chapter 6. Application design 97
structuring Web applications to follow the Model-View-Controller (MVC) design
Figure 6-1 Model-View-Controller design
Many GUI-based client/server applications have been designed using the MVC
design pattern. This powerful and well-tested design pattern can be extended to
support Self-Service Web applications. Throughout this chapter, Model is often
referred to as business logic, View is referred to as page constructor or display
page, and Controller is referred to as interaction controller.
6.1.2 Struts
In a Web environment, changes in the Model cannot be passed on to the View
directly. Instead, the View has to re-query the server to discover modifications in
the state of the application. This is called MVC Model 2 or MVC 2. In this
redbook, we use a well-known implementation of the MVC 2 design pattern
called Struts. Struts is an open-source implementation of MVC 2, part of the
Jakarta project in the Apache Software Foundation. Struts is a framework that
implements the MVC 2 pattern by providing a set of classes, servlets, JSP tag
libraries, and a flexible configuration.
The core of the Struts framework is a flexible control layer based on such
standard technologies as Java servlets, JavaBeans, ResourceBundles, and
Extensible Markup Language (XML).
Struts encourages application architectures based on the Model 2 approach, a
variation of the classic Model-View-Controller (MVC) design paradigm. Struts
provides its own Controller component and integrates with other technologies to
provide the Model and the View. For the Model, Struts can interact with any
Browser client
Web Application Server

Get Self-Service Applications using IBM WebSphere V5.0 and IBM MQSeries Integrator now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.