J2EE Design Pattern : Presentation Tier Patterns : Composite View Design Pattern
|Composite View Design Pattern?|
Composite View creates an aggregate View from atomic sub-components.
Composite View Pattern can be Use
- When presentation tier components interact directly with the business services components like EJB,
- the presentation components are difficult to changes in the implementation of business services components
Instead of providing a mechanism to combine modular, atomic portions of a view into a composite whole, pages are built by embedding formatting code directly within each view.
Sophisticated Web pages present content from numerous data sources, using multiple subviews that comprise a single display page.
Using composite views that are composed of multiple atomic subviews. Each component of the template may be included dynamically into the whole and the layout of the page may be managed independently of the content.
It promotes the reuse of atomic portions of the view by encouraging modular design.
Non-software Composite View Example
Software Composite View Example
Composite View Class diagram
Participants and Responsibilities
A composite view is a view that is an aggregate of multiple subviews.
The View Manager manages the inclusion of portions of template fragments into the composite view. The View Manager may be part of a standard JSP runtime engine, in the form of the standard JSP include tag (<jsp:include>), or it may be encapsulated in a JavaBean helper (JSP 1.0+) or custom tag helper (JSP 1.1+) to provide more robust functionality.
An included view is a subview that is one atomic piece of a larger whole view. This included view could also potentially be a composite, itself including multiple subviews.
|Example for Composite View|