最近初学springmvc,做了一个简单工程实现Conntroller加载,一直报错404,调试许久没找到问题,请求帮助,多谢各位了!
编程环境:win10x64+eclipse+Tomcat8.5
文件结构:
主要代码:
web.xml
MyWeb
index.html
index.htm
index.jsp
default.html
default.htm
default.jsp
contextConfigLocation
classpath:springMvc.xml
org.springframework.web.context.ContextLoaderListener
springMvc
org.springframework.web.servlet.DispatcherServlet
contextConfigLocation
classpath:springMvc.xml
1
true
springMvc
/
HelloController.java
package com.hello;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
@Controller
public class HelloController {
@RequestMapping("/success")
public String helloWorld() {
System.out.println("拦截");
return "success";
}
}
springMvc.xml
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:context="http://www.springframework.org/schema/context"
xmlns:mvc="http://www.springframework.org/schema/mvc"
xsi:schemaLocation="http://www.springframework.org/schema/beans
http://www.springframework.org/schema/beans/spring-beans.xsd
http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context.xsd
http://www.springframework.org/schema/mvc http://www.springframework.org/schema/mvc/spring-mvc.xsd ">
class="org.springframework.web.servlet.view.InternalResourceViewResolver">
调试图:
到此这篇关于关于springmvc报错404的问题的文章就介绍到这了,更多相关springmvc报错404内容请搜索脚本之家以前的文章或继续浏览下面的相关文章希望大家以后多多支持脚本之家!