A decorator is a template that defines the site's layout and style. It must use the <sitemesh:write property="..."/> tag to act as a placeholder for content extracted from the original page.
Minimum Required Decorator
At a minimum, your decorator should include placeholders for title, head, and body:
<html>
<head>
<title><sitemesh:write property="title"/></title>
<sitemesh:write property="head"/>
</head>
<body>
<sitemesh:write property="body"/>
</body>
</html>
Advanced Decorator Example
You can add CSS, headers, and complex layouts. The decorator can be a static .html file or a dynamic template (JSP, FreeMarker, etc.) served by the Servlet engine.
<html>
<head>
<title>SiteMesh example: <sitemesh:write property="title"/></title>
<style>
body { font-family: arial, sans-serif; background-color: #ffffcc; }
.mainBody { padding: 10px; border: 1px solid #555555; }
</style>
<sitemesh:write property="head"/>
</head>
<body>
<h1 class="title">SiteMesh example site: <sitemesh:write property="title"/></h1>
<div class="mainBody">
<sitemesh:write property="body"/>
</div>
<div class="disclaimer">Site disclaimer. This is an example.</div>
</body>
</html>
<html>
<head>
<title>SiteMesh example: <sitemesh:write property="title"/></title>
<style>
/* Some CSS */
body { font-family: arial, sans-serif; background-color: #ffffcc; }
h1, h2, h3, h4 { text-align: center; background-color: #ccffcc;
border-top: 1px solid #66ff66; }
.mainBody { padding: 10px; border: 1px solid #555555; }
.disclaimer { text-align: center; border-top: 1px solid #cccccc;
margin-top: 40px; color: #666666; font-size: smaller; }
</style>
<sitemesh:write property="head"/>
</head>
<body>
<h1 class="title">SiteMesh example site: <sitemesh:write property="title"/></h1>
<div class="mainBody">
<sitemesh:write property="body"/>
</div>
<div class="disclaimer">Site disclaimer. This is an example.</div
</body>
</html>