사전에
감사합니다 .. :
SimpleUrlHandlerMapping
는 컨트롤러에 직접 연결 URL을 수있는 기능을 제공을
UrlFilenameViewController
는 수신 URL을 변환 (예 : URL: /test.html
→ View name: test
).
이하, 필요한 Spring 설정 :
<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/beans"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:util="http://www.springframework.org/schema/util"
xmlns:mvc="http://www.springframework.org/schema/mvc"
xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-3.2.xsd
http://www.springframework.org/schema/util http://www.springframework.org/schema/util/spring-util-3.2.xsd
http://www.springframework.org/schema/mvc http://www.springframework.org/schema/mvc/spring-mvc-3.2.xsd
http://www.springframework.org/schema/data/jpa http://www.springframework.org/schema/data/jpa/spring-jpa-1.2.xsd">
<bean class="org.springframework.web.servlet.view.InternalResourceViewResolver">
<property name="viewClass" value="org.springframework.web.servlet.view.tiles3.TilesView" />
<property name="prefix" value="/WEB-INF/tiles/" />
<property name="suffix" value=".tiles" />
<property name="order" value="1" />
</bean>
<!-- For direct mapping between URL (i.e. index.html ←→ index) and the JSP
to render -->
<bean id="urlFilenameViewController" class="org.springframework.web.servlet.mvc.UrlFilenameViewController" />
<bean class="org.springframework.web.servlet.handler.SimpleUrlHandlerMapping">
<property name="order" value="1" />
<property name="mappings">
<util:map>
<entry key="/test.html" value-ref="urlFilenameViewController" />
</util:map>
</property>
</bean>
</beans>
귀하의 봄 구성에서 <mcv:default-servlet-handler />
태그의주의, 그것은 (널 (null) 및 기본 핸들러의 우선 순위로 Interger.MAX_VALUE
로 설정 반환하지 않음으로 위의 구성을 할 수 있습니다 스프링 문서에서 설명했다).