0
我試圖用spring 3.2.5配置瓷磚3.0.4,當我返回在tiles-definitions.xml中定義的視圖時我得到錯誤404,並且在控制檯中沒有錯誤。瓷磚不工作,沒有錯誤
這裏是配置
的pom.xml
<!-- Web -->
<jsp.version>2.2</jsp.version>
<jstl.version>1.2</jstl.version>
<servlet.version>2.5</servlet.version>
<tiles-version>3.0.4</tiles-version>
<!-- Spring -->
<spring-framework.version>3.2.5.RELEASE</spring-framework.version>
<spring-data-jpa.version>1.4.2.RELEASE</spring-data-jpa.version>
<spring-security.version>3.1.4.RELEASE</spring-security.version>
<!-- TILES -->
<dependency>
<groupId>org.apache.tiles</groupId>
<artifactId>tiles-core</artifactId>
<version>${tiles-version}</version>
</dependency>
<dependency>
<groupId>org.apache.tiles</groupId>
<artifactId>tiles-api</artifactId>
<version>${tiles-version}</version>
</dependency>
<dependency>
<groupId>org.apache.tiles</groupId>
<artifactId>tiles-jsp</artifactId>
<version>${tiles-version}</version>
</dependency>
瓦片-definitions.xml中
<?xml version="1.0" encoding="ISO-8859-1" ?>
<!DOCTYPE tiles-definitions PUBLIC
"-//Apache Software Foundation//DTD Tiles Configuration 3.0//EN"
"http://tiles.apache.org/dtds/tiles-config_3_0.dtd">
<tiles-definitions>
<definition name="base" template="/WEB-INF/template/layout.jsp">
<put-attribute name="header" value="/WEB-INF/template/head.jsp" />
<put-attribute name="menu" value="/WEB-INF/template/navbar.jsp" />
<put-attribute name="body" value="" />
<put-attribute name="footer" value="/WEB-INF/template/footer.jsp" />
</definition>
<definition name="route/home" extends="base">
<put-attribute name="body" value="/WEB-INF/route/list.jsp" />
</definition>
</tiles-definitions>
彈簧視圖解析器 - MVC-調度-servlet.xml中
<!-- TILES -->
<bean id="viewResolver"
class="org.springframework.web.servlet.view.UrlBasedViewResolver">
<property name="viewClass">
<value>
org.springframework.web.servlet.view.tiles3.TilesView
</value>
</property>
</bean>
<bean id="tilesConfigurer"
class="org.springframework.web.servlet.view.tiles3.TilesConfigurer">
<property name="definitions">
<list>
<value>/WEB-INF/tiles/tiles-definitions.xml</value>
</list>
</property>
</bean>
控制米勒方法
@RequestMapping(method = RequestMethod.GET)
public String getRoutes(ModelMap model) {
return "route/home";
}
和servlet配置
<servlet>
<servlet-name>name</servlet-name>
<servlet-class>org.springframework.web.servlet.DispatcherServlet
</servlet-class>
<init-param>
<param-name>contextConfigLocation</param-name>
<param-value>classpath:spring/mvc-dispatcher-servlet.xml
</param-value>
</init-param>
<load-on-startup>1</load-on-startup>
</servlet>
我不能解決這個問題。誰能幫忙?
它的工作!謝謝 – kxyz 2014-09-23 20:49:21
您的問題的解決方案是重點2.對嗎? – Tomas 2014-09-23 20:52:11