Learn Java for Web Development

(Tina Meador) #1
CHAPTER 3: Best Practices in Java EE Web Development 153

Dispatcher View

The Dispatcher View design pattern assembles two patterns, Front Controller and View Helper, into a
microframework with a dispatcher component to utilize the benefits associated with each pattern.


In the Dispatcher View pattern, the dispatcher is responsible for choosing and providing the
mechanism to statically or dynamically present the subsequent view to the user.


The members of the Dispatcher View pattern, as illustrated in Figure 3-15, are as follows:


   Front controller
 Dispatcher
 Helper
 View
 View helper

client Dispatcher HelperView

View
Manager

Business
Service

Composite
view
Footer.jsp

Header.jsp

include

include

include

include

Front
controller

Figure 3-14. Composite View usage


Client Front
Controller Dispatcher

Helper

View

View
Helper

delegates

uses

Figure 3-15. Dispatcher class diagram

Free download pdf