struts2.*配置tiles框架(一)

需要jar包:

commons-digester-2.0.jar

struts2-tiles-plugin-2.0.6.jar

tiles-api-2.0-20070207.130156-4.jar

tiles-core-2.0-20070207.130156-4.jar

commons-beanutils-1.6.jar

commons-logging.jar

freemarker.jar

ognl-2.6.11.jar

struts2-core-2.0.14.jar

xwork-2.0.7.jar

commons-collections-2.1.1.jar


WEB-INF文件下需要:tiles.dtd



Web.xml文件配置如下 :

<!-- 创建Titles工厂 -->

    <context-param>

       <param-name>org.apache.tiles.CONTAINER_FACTORY</param-name>

       <param-value>

           org.apache.struts2.tiles.StrutsTilesContainerFactory

       </param-value>

    </context-param>

    <!-- 全局变量,指定tiles.xml的路径 -->

    <context-param>

       <param-name>

           org.apache.tiles.impl.BasicTilesContainer.DEFINITIONS_CONFIG

       </param-name>

       <param-value>/WEB-INF/tiles.xml</param-value>

    </context-param>

    <!-- tiles监听器(一) 有两种监听器 -->

    <listener>

       <listener-class>

           org.apache.tiles.listener.TilesListener

       </listener-class>

    </listener>

    <!-- tiles监听器(二) 二选一 -->

    <!-- 

       <listener>

       <listener-class>

       org.apache.tiles.listener.TilesListener

       </listener-class>

       </listener>

    -->

    <!-- struts配置 -->

    <filter>

       <filter-name>struts2</filter-name>

       <filter-class>

           org.apache.struts2.dispatcher.FilterDispatcher

       </filter-class>

    </filter>

    <filter-mapping>

       <filter-name>struts2</filter-name>

       <url-pattern>/*</url-pattern>

    </filter-mapping>

你可能感兴趣的:(apache,框架,freemarker,Web,struts)