关于springmvc报错404的问题

网友投稿 194 2023-01-26

关于springmvc报错404的问题

最近初学springmvc,做了一个简单工程实现Conntroller加载,一直paBfzRkd报错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://http://w3.org/2001/XMLSchema-instance"

xmlns:context="http://springframework.org/schema/context"

xmlns:mvc="http://springframework.org/schema/mvc"

xsi:schemaLocation="http://springframework.org/schema/beans

http://springframework.org/schema/beans/spring-beans.xsd

http://springframework.org/schema/context http://springframework.org/schema/context/spring-context.xsd

http://springframework.org/schema/mvc http://springframework.org/schema/mvc/spring-mvc.xsd ">

class="org.springframework.web.servlet.view.InternalResourceViewResolver">

xmlns:xsi="http://http://w3.org/2001/XMLSchema-instance"

xmlns:context="http://springframework.org/schema/context"

xmlns:mvc="http://springframework.org/schema/mvc"

xsi:schemaLocation="http://springframework.org/schema/beans

http://springframework.org/schema/beans/spring-beans.xsd

http://springframework.org/schema/context http://springframework.org/schema/context/spring-context.xsd

http://springframework.org/schema/mvc http://springframework.org/schema/mvc/spring-mvc.xsd ">

class="org.springframework.web.servlet.view.InternalResourceViewResolver">

class="org.springframework.web.servlet.view.InternalResourceViewResolver">

调试图:

版权声明:本文内容由网络用户投稿,版权归原作者所有,本站不拥有其著作权,亦不承担相应法律责任。如果您发现本站中有涉嫌抄袭或描述失实的内容,请联系我们jiasou666@gmail.com 处理,核实后本网站将在24小时内删除侵权内容。

上一篇:浅谈SpringMVC请求映射handler源码解读
下一篇:Java中Object转换为List类型的实现方法
相关文章

 发表评论

暂时没有评论,来抢沙发吧~