
web.xml
xmlns="http://java.sun.com/xml/ns/javaee"
xsi:schemaLocation="http://java.sun.com/xml/ns/javaee
http://java.sun.com/xml/ns/javaee/web-app_3_0.xsd"
version="3.0">
spring-mybatis.xml
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:p="http://www.springframework.org/schema/p"
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-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-4.0.xsd">
spring-mvc.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-4.0.xsd
http://www.springframework.org/schema/context
http://www.springframework.org/schema/context/spring-context-4.0.xsd
http://www.springframework.org/schema/mvc
http://www.springframework.org/schema/mvc/spring-mvc-4.0.xsd">
class="org.springframework.http.converter.json.MappingJacksonHttpMessageConverter">
class="org.springframework.web.servlet.mvc.annotation.AnnotationMethodHandlerAdapter">
![图片上传中...]
Copyright 2014-2025 https://www.php.cn/ All Rights Reserved | php.cn | 湘ICP备2023035733号
报404的话,就是页面、web.xml、spring mvc配置文件、Controller这几个环节出了问题
1、/ 改为/*2、把Controller代码放出来看看,检查返回的视图是否正确,能否对应上jsp页面
<url-pattern>/</url-pattern> 会匹配到/login这样的路径型url,不会匹配到模式为*.jsp这样的后缀型url
<url-pattern>/</url-pattern> 会匹配所有url:路径型的和后缀型的url(包括/login,.jsp,.js和.html等)
<servlet-name>SpringMVC</servlet-name>
<url-pattern>/</url-pattern>
楼主的这段配置没有问题,不需要/ 改为/* ,楼上不要误导。
请贴个controller的@RequestMapping配置。