日期:2014-05-17  浏览次数:20707 次

spring mvc运行时出现的一个错误
第一次用spring mvc这个框架,运行项目的时候出现这个错误,请问是什么原因呢?
WARN : org.springframework.web.servlet.PageNotFound - No mapping found for HTTP request with URI [/helloan/] in DispatcherServlet with name 'appServlet'

------解决方案--------------------
找不到  你这个 /helloan/的请求啊。。。
------解决方案--------------------
没有映射到请求地址/helloan/,/helloan/下的appServlet找不到
------解决方案--------------------
你在 web.xml 里配置了 dispatcherservle t的 url 是 / 或者 /*。导致页面上所有对图片的请求也会被路由进 spring mvc。在你的配置文件里配置一下静态资源或者其他不愿意被路由的路径就好了。
<mvc:resources mapping="/css/**" location="/css/" />
<mvc:resources mapping="/images/**" location="/images/" />
<mvc:resources mapping="/js/**" location="/js/" />