下面是我的tiles.xml配置,
[code]
<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE tiles-definitions PUBLIC
"-//Apache Software Foundation//DTD Tiles Configuration 2.0//EN"
"http://struts.apache.org/dtds/tiles-config_2_0.dtd">
<tiles-definitions> <definition name="mydefinition" template="/testlayout.jsp">
<put-attribute name="header" value="header.jsp"/>
<put-attribute name="footer" value="footer.jsp"/>
</definition>
</tiles-definitions>
[/code]
但是在definition name=...这老是有警告,警告内容如下The content of element type "definition" must match "(icon?,display-
name?,description?,put*,putList*)".在web.xml中
我没有下面这样的配置,
[code]
1: <context-param>
2: <param-name>org.apache.tiles.CONTAINER_FACTORY</param-name>
3: <param-value>org.apache.struts2.tiles.StrutsTilesContainerFactory</param-value>
4: </context-param>
5:
6: <context-param>
7: <param-name>org.apache.tiles.impl.BasicTilesContainer.DEFINITIONS_CONFIG</param-name>
8: <param-value>/WEB-INF/tiles.xml</param-value>
9: </context-param>
[/code]
[code]
<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE tiles-definitions PUBLIC
"-//Apache Software Foundation//DTD Tiles Configuration 2.0//EN"
"http://struts.apache.org/dtds/tiles-config_2_0.dtd">
<tiles-definitions> <definition name="mydefinition" template="/testlayout.jsp">
<put-attribute name="header" value="header.jsp"/>
<put-attribute name="footer" value="footer.jsp"/>
</definition>
</tiles-definitions>
[/code]
但是在definition name=...这老是有警告,警告内容如下The content of element type "definition" must match "(icon?,display-
name?,description?,put*,putList*)".在web.xml中
我没有下面这样的配置,
[code]
1: <context-param>
2: <param-name>org.apache.tiles.CONTAINER_FACTORY</param-name>
3: <param-value>org.apache.struts2.tiles.StrutsTilesContainerFactory</param-value>
4: </context-param>
5:
6: <context-param>
7: <param-name>org.apache.tiles.impl.BasicTilesContainer.DEFINITIONS_CONFIG</param-name>
8: <param-value>/WEB-INF/tiles.xml</param-value>
9: </context-param>
[/code]
<!DOCTYPE tiles-definitions PUBLIC
"-//Apache Software Foundation//DTD Tiles Configuration 2.0//EN"
"http://struts.apache.org/dtds/tiles-config_2_0.dtd">
<tiles-definitions> <definition name="mydefinition" template="/testlayout.jsp">
<put-attribute name="header" value="header.jsp"/>
<put-attribute name="footer" value="footer.jsp"/>
</definition>
</tiles-definitions>web.xml<?xml version="1.0" encoding="UTF-8"?>
<web-app version="2.5"
xmlns="http://java.sun.com/xml/ns/javaee"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://java.sun.com/xml/ns/javaee
http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd">
<context-param>
<param-name>contextConfigLocation</param-name>
<param-value>/WEB-INF/applicationContext.xml</param-value>
</context-param>
<filter>
<filter-name>springSecurityFilterChain</filter-name>
<filter-class>org.springframework.web.filter.DelegatingFilterProxy</filter-class>
</filter><filter-mapping>
<filter-name>springSecurityFilterChain</filter-name>
<url-pattern>/*</url-pattern>
</filter-mapping><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>
<jsp-config>
<jsp-property-group>
<description>JSP Configuration</description>
<display-name>JSPConfiguration</display-name>
<url-pattern>/* </url-pattern>
<el-ignored>false</el-ignored>
</jsp-property-group>
</jsp-config> <welcome-file-list>
<welcome-file>index.jsp</welcome-file>
</welcome-file-list><listener>
<listener-class>org.springframework.web.context.ContextLoaderListener</listener-class>
</listener><listener>
<listener-class>org.apache.struts2.tiles.StrutsTilesListener</listener-class>
</listener>
</web-app>