Datasheet
10
Part I ✦ Introduction
a table named Bookings with the fields PassengerName, DepartureCity,
DestinationCity, TravelDate, and DepartureTime. This data may be accessed
via JDBC using Entity Beans (which we will discuss in detail later in the chapter).
Entity beans and JDBC are discussed in Chapters 16 and 18, respectively.
The view
The view is responsible for presentation issues. It handles how the client will see
the application, and so HTML issues are usually dealt with here. However, other
markup languages such as Wireless Markup Language (WML) and Extensible Markup
Language (XML) are increasingly being used to support more varied types of clients.
The Booking example may be displayed in various ways. For example, on a wireless
device only the most relevant information might be displayed due to the limited
screen size. In fact, the term view may be misleading, implying that it is meant for
visual display only; the view may also be used to present the model via an audio
interface if desired. The method in which the model is presented is abstracted from
the underlying data.
The control
The control part of the paradigm deals with the business logic of the application. It
handles how and when a client interacting with the view is able to access the model.
The control layer usually interacts with authorization and authentication services,
other J2EE services, and external systems to enforce the business rules to be applied
to the application. In our Booking example, the control would determine whether
the view can actually display the model. This may be based on whether the user is
logged in, if he or she has appropriate authorization and so on. It would also hold
the business logic of what to do if the user attempts to view a booking that no
longer exists — for example, should an error be presented to the user? Should the
user be prompted with a screen asking for additional information? These are rules
that change within the business but they do not necessarily force a change on the
view or model.
To support the MVC, the J2EE architecture also provides a varied set of APIs to help
facilitate the separation between the model, view, and control functional blocks
within an application.
Understanding J2EE APIs
The J2EE specification stipulates a number of different APIs, not all of which are
mandatory for every application component type. In some cases, for example the
Java Database Connectivity (JDBC) API, the API may only be mandatory for the
some components, while other APIs may be optional for all components.
Cross-
Reference
c539663 ch01.qxd 7/25/03 9:13 AM Page 10