开发者社区 问答 正文

请教个关于spring mvc PageNotFound的问题? 400 报错

请教个关于spring mvc PageNotFound的问题? 400 报错

测试环境在之间本来是没有问题的,今天突然要做些测试于是启动项目,就出现如下的问题,发现很多请求都报pagenotfound 的错误,根据提示js和gif的文件其实都是在的,项目启动是正常的。请高人指点下 小弟不甚感激!!!


2012-09-27 18:22:43,797 WARN [org.springframework.web.servlet.PageNotFound] -No mapping found for HTTP request with URI [/biz/js/jquery-1.5.1.min.js] in DispatcherServlet with name 'hisun'
  2012-09-27 18:22:43,828 WARN [org.springframework.web.servlet.PageNotFound] -No mapping found for HTTP request with URI [/biz/images/login-top-bg.gif] in DispatcherServlet with name 'hisun'
  2012-09-27 18:22:43,845 WARN [org.springframework.web.servlet.PageNotFound] -No mapping found for HTTP request with URI [/biz/images/login-wel.gif] in DispatcherServlet with name 'hisun'
  2012-09-27 18:22:43,860 WARN [org.springframework.web.servlet.PageNotFound] -No mapping found for HTTP request with URI [/biz/images/login_bg.jpg] in DispatcherServlet with name 'hisun'
  2012-09-27 18:22:43,873 WARN [org.springframework.web.servlet.PageNotFound] -No mapping found for HTTP request with URI [/biz/images/btn-bg2.gif] in DispatcherServlet with name 'hisun'
  2012-09-27 18:22:43,894 WARN [org.springframework.web.servlet.PageNotFound] -No mapping found for HTTP request with URI [/biz/images/login-content-bg.gif] in DispatcherServlet with name 'hisun'
  2012-09-27 18:22:43,908 WARN [org.springframework.web.servlet.PageNotFound] -No mapping found for HTTP request with URI [/biz/images/logo2.png] in DispatcherServlet with name 'hisun'
 


展开
收起
爱吃鱼的程序员 2020-06-04 15:17:23 906 分享 版权
1 条回答
写回答
取消 提交回答
  • https://developer.aliyun.com/profile/5yerqm5bn5yqg?spm=a2c6h.12873639.0.0.6eae304abcjaIB

    正常,因为你在web.xml里配置了dispatcherservlet的url是/或者/*。导致页面上所有对图片的请求也会被路由进spring mvc。在你的配置文件里配置一下静态资源就好了。

    <mvc:resources mapping="/css/**" location="/css/" />
    <mvc:resources mapping="/images/**" location="/images/" />
    <mvc:resources mapping="/js/**" location="/js/" />

    ######嗯,果然还是这个问题,谢谢啊。上次对接口请求进行改造了请求地址的后缀。
    2020-06-04 16:21:28
    赞同 展开评论