嵌套 Apache Tiles 模板
所以我发现了这个: 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 [main] 错误 - org.apache.commons.digester.Digester.error(Digester.java:1635):第 17 行第 68 列解析错误:属性“name”是必需的,并且必须为元素类型“definition”指定。 org.xml.sax.SAXParseException:属性“名称”是必需的,并且必须为元素类型“定义”指定。
即使我为其定义了名称,它仍然给出以下错误:
2009- 05-12 11:35:31,818 [主要]错误 - org.apache.commons.digester.Digester.error(Digester.java:1635):第21行第19列解析错误:元素类型“put-attribute”的内容必须匹配“null”。 org.xml.sax.SAXParseException: 元素类型“put-attribute”的内容必须匹配“null”。
这是什么意思?!!!!
So I found this: http://tiles.apache.org/framework/tutorial/advanced/nesting-extending.html
Here is the 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 funny 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): Parse Error at line 17 column 68: Attribute "name" is required and must be specified for element type "definition". org.xml.sax.SAXParseException: Attribute "name" is required and must be specified for element type "definition".
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): 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".
What is this mean?!!!!
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
将 DTD 版本更改为 2.1 解决了我的问题!
Changing the DTD version to 2.1 solved my problem!
您使用的模式要求 put-attribute 是叶节点,即不能包含子元素 - 所以您不能这样做。 了解较新版本的架构(必须位于 Tiles 文档或示例中)是否允许嵌套切片模板。
-Kalle
所以基本上我使用的是旧版本的图块并使用新版本的架构:
以下是旧嵌套模式的语法:
http://tiles.apache.org/2.0/framework/教程/高级/nesting-extending.html
The schema you use requires that put-attribute is a leaf node, i.e. can't contain child elements - so you can't do that. Find out if a newer version of the schema (must be in Tiles docs or examples) allows for nested tiles templates.
-Kalle
So basically I am using a older version of tiles and using new version schema:
Here is the syntax for older nested schema:
http://tiles.apache.org/2.0/framework/tutorial/advanced/nesting-extending.html