Java Reference
In-Depth Information
Figure 1-6 depicts the relationship between the three components. The events trig-
gered by any user action are intercepted by the controller. Depending on the action, the
controller invokes the model to apply suitable business rules that modify application
data. The controller then selects a view component to present the modified application
data to the end user. Thus, you see that MVC provides guidelines for a clean separation of
responsibilities in an application. Because of this separation, multiple views and con-
trollers can work with the same model.
Figure 1-6. Model-View-Controller
Java EE Architecture with MVC
The MVC concept can be easily applied to form the basis for Java EE application architec-
ture. Java EE servlet technology is ideally suited as a controller component. Any browser
request can be transferred via HTTP to a servlet. A servlet controller can then invoke EJB
model components, which encapsulate business rules and also retrieve and modify the
application data. The retrieved and/or altered enterprise data can be displayed using JSP.
As you'll read later in this topic, this is an oversimplified representation of real-life enter-
prise Java architecture, although it works for a small-scale application. But this has
tremendous implications for application development. Risks can be reduced and pro-
ductivity increased if you have specialists in the different technologies working together.
Moreover, one layer can be transparently replaced and new features easily added without
adversely affecting others (see Figure 1-7).
Search WWH ::

Custom Search