Here is an example of how such a decorator (e.g. /WEB-INF/Decorator.html) might look like:
<html jwcid="shell">
<body jwcid="@Body">
<div id="pageTitle"><span jwcid="@sitemesh:Title"/></div>
<hr/>
<span jwcid="@sitemesh:Body"/>
</body>
</html>
With the corresponding Tapestry page specification (e.g. /WEB-INF/Decorator.page):
<?xml version="1.0"?>
<!DOCTYPE page-specification PUBLIC
"-//Apache Software Foundation//Tapestry Specification 3.0//EN"
"http://jakarta.apache.org/tapestry/dtd/Tapestry_3_0.dtd">
<page-specification>
<component id="shell" type="Shell">
<binding name="title">
'Tapestry Decorator - ' + @com.opensymphony.module.sitemesh.tapestry.Util@getTitle(requestCycle)
</binding>
<binding name="stylesheet" expression="assets.stylesheet"/>
<binding name="delegate">
@com.opensymphony.module.sitemesh.tapestry.Util@getHeadRenderer(requestCycle)
</binding>
</component>
<context-asset name="stylesheet" path="/main.css"/>
</page-specification>
[web-app]/WEB-INF/lib.
The SiteMesh distribution comes with ???.[web-app]/WEB-INF/web.xml
within the <web-app> tag:
<servlet>
<servlet-name>TapApp</servlet-name>
<servlet-class>org.apache.tapestry.ApplicationServlet</servlet-class>
</servlet>
<servlet-mapping>
<servlet-name>TapApp</servlet-name>
<url-pattern>/app</url-pattern>
</servlet-mapping>
<page name="Decorator" specification-path="/WEB-INF/Decorator.page"/> ... <library id="sitemesh" specification-path="/com/opensymphony/module/sitemesh/tapestry/sitemesh.library"/>
decorators.xml to reference a Tapestry page decorator
(e.g. "/app?service=page/Decorator")A working example is included with the SiteMesh distribution, under the src/example-webapp directory.
These components are used to create page Decorators. A Tapestry page decorator is an HTML layout with these components inserted to provide place-holders for the data from the original (undecorated) page.
Description:
Insert contents of original page's HTML<head>tag. The enclosing tag will not be be written, but its contents will. Note: if you are using Tapestry's built-in Shell component, use thecom.opensymphony.module.sitemesh.tapestry.Util.getHeadRenderer(cycle)method with the Shell's 'delegate' parameter instead.
Parameters:
Example:
<span jwcid="@sitemesh:Head />
Description:
Insert contents of original page's HTML<body>tag. The enclosing tag will not be be written, but its contents will.
Note: To include body onload and onunload events (and other body attributes) by using Tapestry's Script component and the com.opensymphony.module.sitemesh.tapestry.Util.getProperty(name, cycle) method.
See the SiteMesh example web application Tapestry.html/Tapesty.page/Tapestry.script combination to see how onload can be included in the decorator.
Parameters:
Example:
<span jwcid="@sitemesh:Body" />
Description:
Insert contents of original page's HTML<title>tag. The enclosing tag will not be be written, but its contents will.
Parameters:
Example:
<span jwcid="@sitemesh:Title" default="Default title" />
Description:
Insert property of original page. See API reference for HTMLPage for details of how properties are obtained from a page.
Parameters:
Example:
<span jwcid="@sitemesh:Property" property="meta.author" default="anonymous"/>
The com.opensymphony.module.sitemesh.Util class includes a few methods to make getting pieces of the decorated page accessible to OGNL expressions and Java code.
Returns contents of original page's HTML <title>
tag. The enclosing tag will not be be included, but its
contents will.
Returns property of original page. See API reference for HTMLPage for details of how properties are obtained from a page.
Returns an IRender suitable for use with Tapestry's Shell components 'delegate' parameter. See the SiteMesh example application for an example usage.