2007/5/12, Garrett Smith <[EMAIL PROTECTED]>:
My requirement is:

I have a layout: main.layout
main.layout has two layouts: head.content, body.content
...
head.content is decorated w/3 attributes: title, pageCSS, pageJS (all text)
body.content is decorated with 1 attribute: content (jsp)
        <definition name="main.layout" template="/tiles/main-layout.jsp">
                <put-attribute name="head" value="head.content"/>
                <put-attribute name="title" value="test"/>
                <put-attribute name="body"   value="body.content"/>
                <put-attribute name="footer"   
value="/res/includes/footer.jsp"/>

                <put-attribute name="title" value=""/>
                <put-attribute name="pageCSS" value=""/>
                <put-attribute name="pageJS" value=""/>
        </definition>
        <definition name="head.content" template="/tiles/head-content.jsp">
                <put-attribute name="title" value="main.layout.title">
                <put-attribute name="pageCSS" value="main.layout.pageCSS"/>
                <put-attribute name="pageJS" value="main.layout.pageJS"/>
        </definition>

Pass-through attributes are not supported in Tiles.
What you can do is creating an extended definition from "head.content"
and apply it.
Correct it this way:

       <definition name="main.layout" template="/tiles/main-layout.jsp">
                <put-attribute name="head" value="site.index"/>.
                <put-attribute name="body"   value="body.content"/>
                <put-attribute name="footer"
value="/res/includes/footer.jsp"/>
        </definition>
        <definition name="head.content" template="/tiles/head-content.jsp">
                <put-attribute name="title" value="main.layout.title">
                <put-attribute name="pageCSS" value="main.layout.pageCSS"/>
                <put-attribute name="pageJS" value="main.layout.pageJS"/>
        </definition>
        <definition name="site.index" extends="head.content".>
                <put-attribute name="title" value="The home page title"/>
                <put-attribute name="pageCSS" value="(no css)"/>
                <put-attribute name="pageJS" value="(no js)"/>
        </definition>

And remember: a definition cannot be used as a template!
See:
http://tiles.apache.org/tutorial/basic/concepts.html

HTH
Antonio

Reply via email to