|
You want to separate a view from its processing logic.
- You want to use template-based views, such as JSP.
- You want to avoid embedding program logic in the view.
- You want to separate programming logic from the view to facilitate
division of labor between software developers and web page designers.
Use Views to encapsulate formatting code and Helpers to encapsulate
view-processing logic. A View delegates its processing responsibilities
to its helper classes, implemented as POJOs, custom tags, or tag files.
Helpers serve as adapters between the view and the model, and perform
processing related to formatting logic, such as generating an HTML table.
Class Diagram
Sequence Diagram
- Template-Based View Strategy
- Controller-Based View Strategy
- JavaBean Helper Strategy
- Custom Tag Helper Strategy
- Tag File Helper Strategy
- Business Delegate as Helper Strategy
- Improves application partitioning, reuse, and maintainability
- Improves role separation
- Eases testing
- Helper usage mirrors scriptlets
- Front Controller
A Front Controller typically delegates to an Application Controller
, to perform action and view management.
- Application Controller
An Application Controller manages view preparation and view creation,
delegating to views and helpers.
- View Transform
An alternative approach to view creation is to perform a View Transform.
- Business Delegate
A Business Delegate reduces the coupling between a helper object and
a remote business service, upon which the helper object can invoke.
|