struts1.2和struts1.3的tiles框架的区别

struts1.3
需要在web.xml文件中加入:
        <init-param>
         <param-name>chainConfig</param-name>
         <param-value>org/apache/struts/tiles/chain-config.xml</param-value>
     </init-param>此段初始化

struts1.2则不需要。

1.2和1.3都需要加:
在struts-config.xml文件中加入:
    <plug-in className="org.apache.struts.tiles.TilesPlugin">
    <set-property property="definitions-config" value="/WEB-INF/tiles-defs.xml"/>  
    <set-property property="moduleAware" value="true" />
    </plug-in>

在tiles-defs.xml文件中加入:
<?xml version="1.0" encoding="UTF-8"?>  
<!DOCTYPE tiles-definitions PUBLIC
"-//Apache Software Foundation//DTD Tiles Configuration 1.1//EN"
"http://jakarta.apache.org/struts/dtds/tiles-config_1_1.dtd">
<tiles-definitions>
<definition name="basePage" template="/jsp/tiles/layout.jsp">
<put name="header" value="/jsp/tiles/header.jsp" />
<put name="body" value="${body}" />
<put name="footer" value="/jsp/tiles/footer.jsp" />
<put name="left" value="/jsp/tiles/left.jsp" />
</definition>

<!--定义登陆成功页面-->
<definition name="logonSuccess" extends="basePage">
<put name="body" value="/jsp/index.jsp" />
</definition>

<definition name="toLogin" extends="basePage">
<put name="body" value="/jsp/login.jsp" />
</definition>

</tiles-definitions> 

你可能感兴趣的:(struts1)