java - 如何在 Struts 1 中使用 Tiles2

标签 java tiles struts-1 tiles2

是否可以将 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/

相关文章:

Java 深度克隆包含 ArrayList 的对象

java - 错误: Client does not support authentication protocol requested by server; consider upgrading MySQL client

java - struts1 ognl静态方法调用

java - ServletRequest.setAttribute 是否允许带句点的键名?

java - 使用UiBinder时是否需要GWT SafeHtml?

java - 需要使用 Java/Selenium 或任何语言从 Google TAG 管理器中提取数据层信息 - 用于自动化目的

html - 带有 imgs 的 Bootstrap 方形瓷砖

java - 确保在 Struts 2 磁贴使用中每个 View 只有一个 html 和 body 标签

spring - Spring MVC 中的平铺和重定向

java - 防止 JSP 缓存值