struts tiles

web.xml

<?xml version="1.0" encoding="UTF-8"?>
<web-app xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns="http://java.sun.com/xml/ns/javaee" xmlns:web="http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd"
xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd"
id="WebApp_ID" version="2.5">
<display-name>myorder</display-name>
<welcome-file-list>
<welcome-file>index.jsp</welcome-file>
<welcome-file>/axis2-web/index.jsp</welcome-file>
</welcome-file-list>
<!-- encodingFilter -->
<filter>
<filter-name>Encoding</filter-name>
<filter-class>com.uu.filter.EncodingFilter</filter-class>
</filter>
<filter-mapping>
<filter-name>Encoding</filter-name>
<url-pattern>*.do</url-pattern>
</filter-mapping>

<!-- ajaxAnywhere -->
<filter>
<filter-name>AjaxAnywhere</filter-name>
<filter-class>org.ajaxanywhere.AAFilter</filter-class>
</filter>
<filter-mapping>
<filter-name>AjaxAnywhere</filter-name>
<url-pattern>*.do</url-pattern>
</filter-mapping>


<!--tiles监听器 -->
<listener>
<listener-class>org.apache.struts2.tiles.StrutsTilesListener</listener-class>
</listener>
<context-param>
<param-name>org.apache.tiles.impl.BasicTilesContainer.DEFINITIONS_CONFIG</param-name>
<param-value>/WEB-INF/tiles/tiles.xml</param-value>
</context-param>


<!-- spring监听器 -->
<listener>
<listener-class>org.springframework.web.context.ContextLoaderListener</listener-class>
</listener>


<context-param>
<param-name>contextConfigLocation</param-name>
<param-value>classpath*:com/uu/configs/spring/ssh.xml</param-value>
</context-param>


<!--axis2 -->
<servlet>
<display-name>Apache-Axis Servlet</display-name>
<servlet-name>AxisServlet</servlet-name>
<servlet-class>org.apache.axis2.transport.http.AxisServlet</servlet-class>
</servlet>
<servlet-mapping>
<servlet-name>AxisServlet</servlet-name>
<url-pattern>/servlet/AxisServlet</url-pattern>
</servlet-mapping>
<servlet-mapping>
<servlet-name>AxisServlet</servlet-name>
<url-pattern>*.jws</url-pattern>
</servlet-mapping>
<servlet-mapping>
<servlet-name>AxisServlet</servlet-name>
<url-pattern>/services/*</url-pattern>
</servlet-mapping>
<servlet>
<display-name>Apache-Axis Admin Servlet Web Admin</display-name>
<servlet-name>AxisAdminServlet</servlet-name>
<servlet-class>org.apache.axis2.transport.http.AxisAdminServlet</servlet-class>
<load-on-startup>100</load-on-startup>
</servlet>
<servlet-mapping>
<servlet-name>AxisAdminServlet</servlet-name>
<url-pattern>/axis2-admin/*</url-pattern>
</servlet-mapping>
<servlet>
<display-name>Axis Admin Servlet</display-name>
<servlet-name>AdminServlet</servlet-name>
<servlet-class>org.apache.axis.transport.http.AdminServlet</servlet-class>
<load-on-startup>100</load-on-startup>
</servlet>
<servlet-mapping>
<servlet-name>AdminServlet</servlet-name>
<url-pattern>/servlet/AdminServlet</url-pattern>
</servlet-mapping>

<!-- struts2 -->
<filter>
<filter-name>struts2</filter-name>
<filter-class>org.apache.struts2.dispatcher.ng.filter.StrutsPrepareAndExecuteFilter</filter-class>
<init-param>
<param-name>config</param-name>
<param-value>struts-default.xml,struts-plugin.xml,/com/uu/configs/struts/struts.xml</param-value>
</init-param>
</filter>
<filter-mapping>
<filter-name>struts2</filter-name>
<url-pattern>/*</url-pattern>
</filter-mapping>

</web-app>


struts.xml

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE struts PUBLIC
    "-//Apache Software Foundation//DTD Struts Configuration 2.1.7//EN"
    "http://struts.apache.org/dtds/struts-2.1.7.dtd">
<struts>
<constant name="struts.i18n.encoding" value="utf-8" />
<constant name="struts.ui.theme" value="simple" />
<constant name="struts.devMode" value="true" />
<constant name="struts.configuration.xml.reload" value="true" />
<constant name="struts.serve.static.browserCache" value="false" />
<constant name="struts.objectFactory" value="spring" />
<constant name="struts.multipart.maxSize" value="10485760" />
<constant name="struts.devMode" value="true" />
<constant name="struts.multipart.saveDir" value="E:\tmp" />
<constant name="struts.action.extension" value="do" />
<package name="basepackage" extends="json-default">
<result-types>
<result-type name="tiles"
class="org.apache.struts2.views.tiles.TilesResult" />
</result-types>
<action name="jump" class="commonAction">
<result name="success" type="tiles">jump</result>
</action>
<action name="changelanguage" class="commonAction" method="changelanguage">
<result name="success"></result>
</action>
<action name="searchAllMenu" class="commonAction" method="searchAllMenu">
<result name="toMenuList" type="tiles">menuList</result>
</action>
<action name="updateMenu" class="commonAction" method="updateMenu">
<result name="success" type="tiles">editMenu</result>
</action>
<action name="updateMenuDetail" class="commonAction" method="updateMenuDetail">
<result name="success" type="tiles">menuList</result>
</action>
<action name="searchClientXml" class="commonAction" method="searchClientXml">
<result name="success" type="tiles">clientMenuFile</result>
</action>
<action name="generateNewXML" class="commonAction" method="generateNewXML">
</action>
<action name="deleteXml" class="commonAction" method="deleteXml">
</action>
</package>
<include file="com/uu/configs/struts/food/struts-food.xml"></include>
</struts>


tiles.xml

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE tiles-definitions PUBLIC
"-//Apache Software Foundation//DTD Tiles Configuration 2.0//EN"
"http://tiles.apache.org/dtds/tiles-config_2_0.dtd">


<tiles-definitions>
<definition name="layout" template="/WEB-INF/layout/layout.jsp">
<put-attribute name="header" value="/WEB-INF/layout/header.jsp" />
<put-attribute name="menu" value="/WEB-INF/layout/menu.jsp" />
<put-attribute name="footer" value="/WEB-INF/layout/footer.jsp" />
</definition>


<definition name="jump" extends="layout">
<put-attribute name="title" value="系统首页" />
<put-attribute name="body" value="/WEB-INF/jsp/welcomePage.jsp" />
</definition>


<definition name="menuList" extends="layout">
<put-attribute name="title" value="栏目管理" />
<put-attribute name="body"
value="/WEB-INF/jsp/systemAdmin/menuList.jsp" />
</definition>


<definition name="editMenu" extends="layout">
<put-attribute name="title" value="栏目编辑" />
<put-attribute name="body"
value="/WEB-INF/jsp/systemAdmin/menuEdit.jsp" />
</definition>


<definition name="clientMenuFile" extends="layout">
<put-attribute name="title" value="客户端菜单管理" />
<put-attribute name="body"
value="/WEB-INF/jsp/systemAdmin/clientXmlList.jsp" />
</definition>


<definition name="addFoodPage" extends="layout">
<put-attribute name="title" value="添加菜品" />
<put-attribute name="body" value="/WEB-INF/jsp/foodAdmin/addFoodPage.jsp" />
</definition>

<definition name="listFood" extends="layout">
<put-attribute name="title" value="菜品列表" />
<put-attribute name="body" value="/WEB-INF/jsp/foodAdmin/listFood.jsp" />
</definition>
</tiles-definitions>



你可能感兴趣的:(tiles)