Posted by zarar in zarar on Jan 19, 2006 4:49:00 AM
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<content> 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:
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.