SpringMVC异常_Could not resolve view with name 'javascripts/jquery-2.1.4' in servlet with name

Posted

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了SpringMVC异常_Could not resolve view with name 'javascripts/jquery-2.1.4' in servlet with name相关的知识,希望对你有一定的参考价值。

    今天在编写代码的时候,自己页面中的按钮都无法点击,CSS样式也无法加载出来,查看之前的Spring MVC 的配置文件也是都正常,查看后台,发现如下错误

严重: Servlet.service() for servlet [springMVC] in context with path [/spring-idap-web] threw exception [Could not resolve view with name ‘javascripts/jquery-2.1.4‘ in servlet with name ‘springMVC‘] with root cause
javax.servlet.ServletException: Could not resolve view with name ‘javascripts/jquery-2.1.4‘ in servlet with name ‘springMVC‘
    at org.springframework.web.servlet.DispatcherServlet.render(DispatcherServlet.java:1211)
    at org.springframework.web.servlet.DispatcherServlet.processDispatchResult(DispatcherServlet.java:1011)
    at org.springframework.web.servlet.DispatcherServlet.doDispatch(DispatcherServlet.java:955)
    at org.springframework.web.servlet.DispatcherServlet.doService(DispatcherServlet.java:877)
    at org.springframework.web.servlet.FrameworkServlet.processRequest(FrameworkServlet.java:966)
    at org.springframework.web.servlet.FrameworkServlet.doGet(FrameworkServlet.java:857)
    at javax.servlet.http.HttpServlet.service(HttpServlet.java:622)
    at org.springframework.web.servlet.FrameworkServlet.service(FrameworkServlet.java:842)
    at javax.servlet.http.HttpServlet.service(HttpServlet.java:729)
    at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:291)
    at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
    at org.springframework.web.filter.HiddenHttpMethodFilter.doFilterInternal(HiddenHttpMethodFilter.java:77)
    at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:107)
    at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:239)
    at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
    at org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:52)
    at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:239)
    at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
    at org.springframework.web.filter.CharacterEncodingFilter.doFilterInternal(CharacterEncodingFilter.java:88)
    at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:107)
    at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:239)
    at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
    at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:212)
    at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:106)
    at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:502)
    at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:141)

后来百度了老半天,什么也没有发现,重新启动MyEclipse,tomcat,甚至机器都重新启动了一遍还是不行。有时候感觉很二啊,感觉出错了重启就好了。。之后逐行比对SVN资源库上的代码,最终终于找到问题的原因

    @RequestMapping//问题的原因
    public ModelAndView  showHomePage()
    {
        ModelAndView model = new ModelAndView();
        return model;
    }

其实是在编写Controller的时候,其中的某个方法没有映射到具体的URL地址。所以导致最终出错。解决办法就是为@RequestMapping添加一个URL地址就好了。

以上是关于SpringMVC异常_Could not resolve view with name 'javascripts/jquery-2.1.4' in servlet with name的主要内容,如果未能解决你的问题,请参考以下文章

Spring定时任务 Could not find default TaskScheduler bean异常处理

http://mirrors.aliyun.com/centos/7/os/x86_64/repodata/repomd.xml: [Errno 14] curl#6 - “Could not res

pg启动异常could not open lock file "/tmp/.s.PGSQL.5432.lock":

IO 异常:The Network Adapter could not establish the connection 怎么解决

Could not resolve view with name 'xxx' in servlet with name 'dispatcherServlet'(@Res

Maven异常:Could not find artifact