I try not to complain about lack of documentation. So in this blog entry, I'll show how simple it is to pass in arbitrary data from JSP pages to SiteMeshdecorators.

For every piece of information that you want to pass from the JSP page to the SiteMesh decorator, create a&ltcontent> tag. In the following example, I want to pass in two pieces of data, a "page name" and a "site section". So I must declare two content tags in the JSP page:

<content tag="pageName">
    Login Page
<content tag="siteSection">

Now, all thats left is telling the SiteMesh decorator to access this information, and that is very easily done using the following syntax in the decorator:

<decorator:getProperty property="page.pageName"/>
<decorator:getProperty property="page.siteSection"/>

That's it. Now you can pass in anything you want and aren't restricted to using <decorator:head/>,<decorator:body/> and<decorator:title/>. My problem with these three tags is that I don't want to declare a head, title and body tag for every JSP page since the JSP page is usually the "main" content of the page and shouldn't have to declare such basic HTML elements. IMHO using <content> tags is a cleaner and more powerful solution as you can pass in an unlimited amount of data without using specific tags. However, combining the three tags mentioned with the <content> tag is also a fine strategy.