Datasheet
9
Chapter 1 ✦ Understanding Java and the J2EE Platform
In addition to specifying the lifecycle roles, the J2EE also recommends the usage of
the model-view-controller (MVC) design pattern to ease the burden on developing
long-lived applications.
Working with the Model-View-Controller
The MVC paradigm provides a pattern for separating the presentation logic (view),
business logic (control), and data objects (model). J2EE’s architecture maps onto
the MVC nicely. Typically, entity beans are used to provide the model logic, while a
mix of entity beans and session beans are used to provide the control logic, and
Web components are used to implement both control and presentation logic. In
practice, however, the separation of the three types of logic is not as distinct, and
additional patterns are often needed to support the development cycle. Figure 1-3
shows how the three different logical functional blocks work together.
Figure 1-3: MVC pattern
Sun has provided guidelines in the form of Java BluePrints. A sample application,
Java Adventure Builder, has been developed specifically for J2EE 1.4 and you can
download it from
http://www.javasoft.com.
The model
The M in MVC refers to the data object model. For example, in an airline ticketing
service you may have the concept of a booking, which in the real world is repre-
sented by a paper ticket. The model deals with issues such as how the booking
is represented within the software system, where it is persisted, and how it is
accessed. For example, the booking may be held within a relational database within
Controller
Displayed by
Manipulates User interactions
Model View
c539663 ch01.qxd 7/25/03 9:13 AM Page 9