Jaydoh's Template Mechanism - A Proven J2EE Pattern
[ Thanks to Brad Marlborough for this information. ] The J2EE Composite View pattern identifies a recurring problem around an application's presentation layer and provides an abstract outline on how to solve the problem. Jaydoh's Template Mechanism is a fully functioning implementation of the Composite View pattern that provides a flexible and highly modular way of combining a series of static and dynamic components in a variety of ways.
In March 2001, Sun Microsystems released the first beta version of Sun Java Center J2EE Patterns. The J2EE patterns describe the typical problems encountered by enterprise application developers and document a pattern, or abstract solution, to these problems. The J2EE patterns are an important contribution to the industry because they provide developers with a common nomenclature and abstract solutions to recurring problems.
One recurring problem that all enterprise applications have in common is how to present data to the client. Do you use JSPs or Servlets? How do you effectively separate presentation from business logic? How can you support multiple devices without duplicating code? How do you avoid making multiple modifications to your application every time you make a change to your view layout?
J2EE Composite View
One design solution being put forth by Sun's J2EE patterns is the Composite View Pattern. "This solution provides for the creation of a composite view based on the inclusion and substitution of modular dynamic and static template fragments. This solution also promotes the reuse of atomic portions of the View, and encourages modular design. It is appropriate to use a composite view to generate displays containing pluggable atomic components that may be combined in a variety of ways. This scenario occurs, for example with portal sites that include numerous independent views, such as news feeds, weather information, and stock quotes on a single page. There may be a runtime overhead associated with this pattern, and it is the tradeoff for the pattern's improved flexibility.
A system typically has many views, some of which rely on similar atomic pieces of the display to be presented in alternate ways, such as in different locations on the screen or containing modified text. An example is a customer inventory table that is used on multiple pages, surrounded by different information on each page. Another example is a page that includes a header and footer. If each atomic subcomponent is coded directly into the main view in which it is included, the result is duplicate code that is difficult to modify and maintain.
When a component piece is coded directly into the view in which it is used, a change to that subcomponent requires changing each view that contains the subcomponent, requiring multiple modifications to make a single change."1
A Proven Implementation
Jaydoh's HTML Template Mechanism is a fully functioning implementation of the J2EE Composite View pattern and specifically targets the presentation problems detailed above.
Jaydoh's Template mechanism was created to promote the rapid development and easy maintenance of web based applications. The Template subsystem provides a modular mechanism that allows web applications to be built with a consistent look and feel with the capability of producing dynamic HTML content.
HTML templates also offer a clean separation between presentation and the business logic. By decoupling the details of the HTML from the backend JavaTM services, those stronger on web design can focus on the look and feel of the web site without having to learn Java or another programming language. Conversely, those strong in programming can focus on the development of the backend Java services and business logic without any knowledge or worry about how the results will be presented in HTML. In other words, multiple parties can now work in parallel to reduce development time. Changes are also easier to implement since a change in the business logic will not affect the presentation or look and feel of the application and vice versa.