springMVC配置求助
xmlns:util="http://www.springframework.org/schema/util" xmlns:mvc="http://www.springframework.org/schema/mvc"
xsi:schemaLocation="http://www.springframework.org/schema/util http://www.springframework.org/schema/util/spring-util-3.1.xsd
http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-3.1.xsd
http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context-3.1.xsd
http://www.springframework.org/schema/mvc http://www.springframework.org/schema/mvc/spring-mvc-3.1.xsd">
<!--注解说明 -->
<context:annotation-config />
<!-- 启动包扫描功能,以便注册带有@Controller、@Service、@repository、@Component等注解的类成为spring的bean -->
<context:component-scan base-package="com.test" />
<bean alt="springMVC配置" /> springmvc Spring
[解决办法]
http://localhost:8080/BootStrap/index.do 呢
[解决办法]
<servlet-mapping>
<servlet-name>spring</servlet-name>
<url-pattern>*.do</url-pattern>
</servlet-mapping>
后面要带.do springmvc 的拦截器才能拦截到
或者改成
<servlet-mapping>
<servlet-name>spring</servlet-name>
<url-pattern>/</url-pattern>
</servlet-mapping>
[解决办法]
还有最好在
public class RestConstroller{
前面加注解
@RequestMapping("rest")
然后这样访问http://localhost:8080/BootStrap/rest/index
[解决办法]
你debug 下看有没有道 controller 里面的index 方法。
[解决办法]
RestConstroller类加上@Controller注释试试
[解决办法]
访问的时候加上.do:
http://localhost:8080/BootStrap/index.do
[解决办法]
你这个
@RequestMapping(value = "/index", method = RequestMethod.GET)
public String index(Model model) {
return "index";
}
方法走了?