我的项目yous
存在问题:http://localhost:8080/yous/cc
它有效,但http://localhost:8080/yous/
我得404 error
déc. 26, 2013 8:37:26 PM org.springframework.web.servlet.DispatcherServlet noHandlerFound
Avertissement: No mapping found for HTTP request with URI [/yous/] in DispatcherServlet with name 'appServlet'
我的控制器:
@RequestMapping(value = "/cc")
public String printWelcome() {
System.out.println("Hello");
return "/WEB-INF/pages/hello.jsp";
}
@RequestMapping(value = "/")
public String printIndex() {
return "index.html";
}
我的web.xml
<servlet>
<servlet-name>appServlet</servlet-name>
<servlet-class>org.springframework.web.servlet.DispatcherServlet</servlet-class>
<init-param>
<param-name>contextConfigLocation</param-name>
<param-value>appServlet-servlet.xml</param-value>
</init-param>
<load-on-startup>1</load-on-startup>
</servlet>
<servlet-mapping>
<servlet-name>appServlet</servlet-name>
<url-pattern>/</url-pattern>
</servlet-mapping>
我的appServlet-servlet.xml
<context:component-scan base-package="controller"/>
<mvc:annotation-driven />
答案 0 :(得分:0)
我们用
解决问题@RequestMapping(value="/index")
似乎/index
处理/
,有人可以解释为什么吗?