tiles-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Antonio Petrelli" <antonio.petre...@gmail.com>
Subject Re: Tiles 2.0: pass-thru attributes?
Date Sat, 12 May 2007 07:54:12 GMT
2007/5/12, Garrett Smith <dhtmlkitchen@gmail.com>:
> 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

Mime
View raw message