You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tiles.apache.org by Gert Vanthienen <ge...@skynet.be> on 2007/06/04 10:24:21 UTC

attribute not found on second page

L.S.,


I have created a tiles.xml file to define (see below)
- template.webshop, which insert a two-column body (navigation and 
content) in a JSP page
- webshop.home uses template.webshop and fills in the navigation and 
content attributes

However, Tiles complains about "Attribute 'content' not found" when 
showing the webshop.home definition.  Why?  Can't you insert a page 
which contains <tiles:insertAttribute /> tags itself?


Thanks for any help,

Gert



tiles.xml

    <definition name="template.webshop" templates="/templates/basic.jsp">
        <put-attribute name="header" 
value="/templates/shopping_header.jsp"/>
        <put-attribute name="body" value="/templates/two_column_body.jsp"/>
    </definition>

    <definition name="webshop.home" extends="template.webshop">
        <put-attribute name="navigation" 
value="/templates/navigation_collapsed.jsp"/>
        <put-attribute name="content" value="/home.jsp" />
    </definition>   

Re: attribute not found on second page

Posted by Antonio Petrelli <an...@gmail.com>.
2007/6/4, Gert Vanthienen <ge...@skynet.be>:
> I have created a tiles.xml file to define (see below)
> - template.webshop, which insert a two-column body (navigation and
> content) in a JSP page
> - webshop.home uses template.webshop and fills in the navigation and
> content attributes
>
> However, Tiles complains about "Attribute 'content' not found" when
> showing the webshop.home definition.  Why?  Can't you insert a page
> which contains <tiles:insertAttribute /> tags itself?

JSP pages used in attribute are never used as templates! Probably you
wanted to fill "navigation" and "content" attributes of
"two_column_body.jsp" and not of "basic.jsp".

>     <definition name="template.webshop" templates="/templates/basic.jsp">
>         <put-attribute name="header"
> value="/templates/shopping_header.jsp"/>
>         <put-attribute name="body" value="/templates/two_column_body.jsp"/>
>     </definition>
>
>     <definition name="webshop.home" extends="template.webshop">
>         <put-attribute name="navigation"
> value="/templates/navigation_collapsed.jsp"/>
>         <put-attribute name="content" value="/home.jsp" />
>     </definition>

Change it this way:

     <definition name="template.webshop" templates="/templates/basic.jsp">
         <put-attribute name="header"
 value="/templates/shopping_header.jsp"/>
     </definition>

     <definition name="webshop.home.body"
templates="/templates/two_column_body.jsp">
         <put-attribute name="navigation"
value="/templates/navigation_collapsed.jsp"/>
         <put-attribute name="content" value="/home.jsp" />
     </definition>

     <definition name="webshop.home" extends="template.webshop">
         <put-attribute name="body"
 value="webshop.home.body"/>
     </definition>

HTH
Antonio