SiteMesh介绍

SiteMesh is a little different from other templating technologies
in that it uses the decorator design pattern to embellish HTML with
additional HTML provided in a secondary file.
The second HTML file, known as the decorator,uses special tags to
denote when the title (between the <title>tags), the header
(between the <head>tags), and the body (between the <body> tags)
from the original HTML should be inserted.
The decoration of the HTML with the decorator occurs in real time,
and SiteMesh can decorate all HTML sources, whether produced by
JSP, PHP, Perl, or Ruby (although if you are using other languages,
you would most likely avoid deploying it to a servlet container,
which SiteMesh needs to operate within).

The decorator that SiteMesh selects is determined by the
decorators.xmlconfiguration file.
In this file, you can associate URL patterns, request parameters,
or event browser agent information with different decorator files.
This mechanism makes SiteMesh extremely powerful.
There are also SiteMesh tags to obtain additional properties
from the original HTML,as well as for the page to specify which template
it wants to use and to decorate inline or external content from within the
page itself.
Information on all the available tags can be found in the SiteMesh
documentation at http://www.opensymphony.com/sitemesh/tags.html.

 

Most other templating technologies,such as Apache Tiles,take the opposite

approach and use a template that specifies the subparts that need to be included.

SiteMesh can also work in this mode, although it’s usually the last configuration option used.

你可能感兴趣的:(html,jsp,PHP,perl,Ruby)