是否可以将 Tiles2 与 Struts 1 一起使用?
我已按照迁移指南中的说明进行操作 http://tiles.apache.org/migration/index.html
但是当我尝试访问我的操作时,出现了这个错误:
org.apache.tiles.template.NoSuchAttributeException: Attribute 'body' not found.
我在 struts-config.xml 中有:
<controller processorClass="org.apache.struts.tiles.TilesRequestProcessor"
maxFileSize="10M" tempDir="/tmp" />
<plug-in className="org.apache.struts.tiles.TilesPlugin">
<set-property property="definitions-config" value="/WEB-INF/tiles-defs.xml" />
</plug-in>
和 tiles-defs.xml
<definition name="mainTemplate" template="/common/templates/mainTemplate.jsp" />
<definition name="index" extends="mainTemplate">
<put-attribute name="body" type="string" value="/views/index/index.jsp" />
</definition>
最佳答案
在您的 struts-config.xml
中进行以下更改<controller processorClass=”org.apache.struts.tiles2.TilesRequestProcessor”/>
<plug-in className=”org.apache.struts.tiles2.TilesPlugin” >
查找 Tiles2 插件的来源 here .
关于java - 如何在 Struts 1 中使用 Tiles2,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/13765077/