Nesting Apache Tiles Template
So I found this: http://tiles.apache.org/framework/tutorial/advanced/nesting-extending.html
Here's an example:
<definition name="myapp.homepage" template="/layouts/classic.jsp">
<put-attribute name="title" value="Tiles tutorial homepage" />
<put-attribute name="header" value="/tiles/banner.jsp" />
<put-attribute name="menu" value="/tiles/common_menu.jsp" />
<put-attribute name="body">
<definition template="/layouts/three_rows.jsp">
<put-attribute name="one" value="/tiles/headlines.jsp" />
<put-attribute name="two" value="/tiles/topics.jsp" />
<put-attribute name="one" value="/tiles/comments.jsp" />
</definition>
</put-attribute>
<put-attribute name="footer" value="/tiles/credits.jsp" />
</definition>
So I defined this:
<definition name="mgmt.base.layout" extends="base.layout">
<put-attribute name="body">
<definition template="/WEB-INF/mgmt/config/mgmtBody.jsp"/>
<put-attribute name="adminLeft" value="/WEB-INF/mgmt/config/left.jsp"/>
<put-attribute name="adminRight" value="/tiles/blank.html"/>
</definition>
</put-attribute>
</definition>
But the fun part is that even their own documentation is wrong:
2009-05-12 11: 20: 56,088 [main] ERROR - org.apache.commons.digester.Digester.error (Digester.java:1635): Analysis error at line 17 column 68: "name" attribute is required and must be specified to define the element type. org.xml.sax.SAXParseException: An attribute name is required and must be specified to define the element type.
Even though I define a name for it, it still gives the following error:
2009-05-12 11: 35: 31,818 [main] ERROR - org.apache.commons.digester.Digester.error (Digester.java:1635): parsing error on line 21, column 19: content of the "put-attribute" element type "must match" null ". org.xml.sax.SAXParseException: The content of the "put-attribute" element type must match "null".
What does it mean?!!!!
a source to share
The schema you are using requires the put-attribute to be a leaf node, meaning it cannot contain children, so you cannot do that. Find out if a newer version of the schema (should be in the Tiles docs or samples) is needed for the nested template templates.
-Kalle
So basically I am using the older version of the tile and using the new schema: Here is the syntax for the old nested schema: http://tiles.apache.org/2.0/framework/tutorial/advanced/nesting-extending.html
a source to share