看一下 启动时 spring输出 的 log 有没有把你的controller 注入 Mapped URL path [/xxx/xxx/xxxx] onto handler 'xxxController'
感觉 你的config 这个包 有点怪怪的啊. 好久 没用eclipse了. 应该不是 这个样子的吧? 打开eclipse 瞧了瞧...确实 不一样.
这个感觉看不出问题了,你断点能进controller吗?还有修改配置文件重启了没
classpath:spring-mvc.xml
你配置视图解释类,定义跳转的文件路径写错了吧 应该是<property name="prefix" value="/WEB-INF/" />吧
工程名对了吗,静态能访问的路径发下
<!-- 指定Sping组件扫描的基本包路径 --> <context:component-scan base-package="*.*" > <!-- 自动扫描Controller --> <context:include-filter type="annotation" expression="org.springframework.stereotype.Controller"/> </context:component-scan> 没有配置自动扫描吧
报错信息也不贴
如下新建一个spring+springmvc+mybatis项目 问题:项目启动之后静态页面可以访问,Controller类里面的方法访问报404是怎么回事,mvc配置如下 web.xml 配置如下 配置文件都检查了没问题,请指点下是哪里的问题,谢谢。
81,092
社区成员
341,716
社区内容
加载中
试试用AI创作助手写篇文章吧