springmvc 请求无法到达controller,出现404错误
web.xml
testmvc
index.html
index.htm
index.jsp
default.html
default.htm
default.jsp
springmvc
org.springframework.web.servlet.DispatcherServlet
contextConfigLocation
classpath:springmvc-servlet.xml
1
springmvc
/
org.springframework.web.context.ContextLoaderListener
springmvc-servlet.xml
WelcomeController.java
package com.iszhmj.controller;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
@Controller
@RequestMapping("/welcome")
public class WelcomeController {
@RequestMapping("/test")
public String index()
{
System.out.println("index");
return "index";
}
}


Copyright 2014-2025 https://www.php.cn/ All Rights Reserved | php.cn | 湘ICP备2023035733号
把Spring-MVC的debug日志输入来看看!
所以你访问的url是怎么写的呢?
推荐所有web开发者通读一下http协议
springmvc-servlet.xml要放在src下吧?
看下我的博客吧 http://blog.csdn.net/yege2006...
配置文件里添加
<context:annotation-config/>试试按照这个配置 <param-value>classpath:springmvc-servlet.xml</param-value> springmvc-servlet.xml文件需要放在src目录下。 然后你确定你的项目可以启动成功??
应该是放在src下面的