©


Core J2EE Pattern Catalog

© CoreJ2EEPatterns
All Rights Reserved.

Last Updated:
January 29, 2006 8:54 PM

 

In Association with Amazon.com


Composite View

See Core J2EE Patterns, 2nd Edition for full description of this pattern and its strategies.

Problem

You want to build a view from modular, atomic component parts that are combined to create a composite whole, while managing the content and the layout independently.

Forces

  • You want common subviews, such as headers, footers and tables reused in multiple views, which may appear in different locations within each page layout.
  • You have content in subviews which might which frequently change or might be subject to certain access controls, such as limiting access to users in certain roles.
  • You want to avoid directly embedding and duplicating subviews in multiple views which makes layout changes difficult to manage and maintain.

Solution

Use Composite Views that are composed of multiple atomic subviews. Each subview of the overall template can be included dynamically in the whole, and the layout of the page can be managed independently of the content.

Class Diagram

Sequence Diagram

Strategies

  • JavaBean View Management Strategy
  • Standard Tag View Management Strategy
  • Custom Tag View Management Strategy
  • Transformer View Management Strategy
  • Early-Binding Resource Strategy
  • Late-Binding Resource Strategy

Consequences

  • Improves modularity and reuse
  • Adds role-based or policy-based control
  • Enhances maintainability
  • Reduces maintainability
  • Reduces performance

Related Patterns

  • View Helper
    A Composite View can fulfill the role of View in View Helper.
  • Composite [GoF]
    A Composite View is based on Composite [GoF], which describes part-whole hierarchies where a composite object is composed of numerous subparts.
Contact Us © CoreJ2EEPatterns.com. All Rights Reserved. Terms of use