저는 여전히 Tiles에 익숙해 지려고합니다. 전에 Struts 1.x에서 아무런 문제없이 사용했지만 Spring MVC에서는 그렇지 않습니다. Struts를 사용하면 링크를 통해 타일로 정의 된 페이지로 이동하기 위해 액션을 만들거나 앞으로 태그를 사용해야한다는 것을 알고 있습니다. 스프링을 사용하면 마찬가지로 컨트롤러를 사용해야 할 것이라고 생각했습니다. 그러나, 그것은 컨트롤러가 I이 오류가 실행 할 때마다 때문에 내 타일 정의를 발견하지 않는 것 : 난 그냥 배우고 어떻게 작동하는지 알아 내기 위해 노력하고 있기 때문에Spring MVC와 Tiles의 연결
Jul 17, 2014 11:21:07 AM org.springframework.web.servlet.DispatcherServlet noHandlerFound WARNING: No mapping found for HTTP request with URI [/BudgeAllocatorWeb/home] in >DispatcherServlet with name 'spring-mvc'
내 컨트롤러는 정말 간단합니다 :
@Controller
@RequestMapping("/login")
public class LoginController {
@RequestMapping(method=RequestMethod.GET)
public String login(ModelMap map) {
return "home";
}
}
그리고 내 타일 - def.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="base" template="/pages/base_layout/layout.jsp">
<put-attribute name="title" value="" />
<put-attribute name="header" value="/pages/base_layout/header.jsp" />
<put-attribute name="menu" value="/pages/base_layout/menu.jsp" />
<put-attribute name="body" value="" />
<put-attribute name="footer" value="/pages/base_layout/footer.jsp" />
</definition>
<definition name="home" extends="base">
<put-attribute name="title" value="Budgeter" />
<put-attribute name="body" value="/pages/home.jsp" />
</definition>
</tiles-definitions>
그리고 내 스프링 MVC - 서블릿 XML 파일 :
<beans xmlns="http://www.springframework.org/schema/beans"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:context="http://www.springframework.org/schema/context"
xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-3.0.xsd
http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context-3.0.xsd">
<context:component-scan base-package="controllers" />
<bean class="org.springframework.web.servlet.view.InternalResourceViewResolver">
<!-- <property value="/" name="prefix" />
<property value=".jsp" name="suffix" /> -->
</bean>
<!-- Spring Tiles -->
<bean id="tilesviewResolver" class="org.springframework.web.servlet.view.tiles2.TilesViewResolver">
<property name="viewClass">
<value>
org.springframework.web.servlet.view.tiles2.TilesView
</value>
</property>
</bean>
<bean id="tilesConfigurer" class="org.springframework.web.servlet.view.tiles2.TilesConfigurer">
<property name="definitions">
<list>
<value>/WEB-INF/tiles-def.xml</value>
</list>
</property>
</bean>
</beans>
그래서 내 컨트롤러는 내 타일 정의에 정의 된 "집"을 치려고하는 "집"을 반환합니다. 일반 페이지에서는 작동하지만 타일 정의에서는 작동하지 않습니다. 내가 여기서 누락 된 것이 있습니까?