我找到:http://tiles.apache.org/framework/tutorial/advanced/nesting-extending.html
下面是例子:
<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>
所以我这样定义:
<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>
但有趣的是,即使自己的文档是错误的:
2009-05-12 11:20:56,088[主要]错误——org.apache.commons.digester.Digester.error (Digester.java: 1635):解析错误在17列68行:“name”属性是必需的,必须指定元素类型“定义”。org.xml.sax。:都抛出SAXParseException异常属性“name”是必需的,必须指定元素类型“定义”。
虽然我为它定义一个名字,它仍然给了以下错误:
2009-05-12 11:35:31,818 [main] ERROR - org.apache.commons.digester.Digester.error(Digester.java:1635): Parse Error at line 21 column 19: The content of element type "put-attribute" must match "null". org.xml.sax.SAXParseException: The content of element type "put-attribute" must match "null".
这是什么意思? ! ! ! !