网页访问静态资源问题

问题:在WebContent目录下放置了一张image.png图片:
使用路径http://localhost:8080/SpringMVCProject/image.png直接访问这个静态资源,但是出现了错误:

报错的信息如下

HTTP Status 500 – Internal Server Error


Type 异常报告

消息 Request processing failed; nested exception is java.lang.IllegalStateException: A RequestDispatcher could not be located for the default servlet 'org.springframework.web.servlet.resource.DefaultServletHttpRequestHandler'

描述 服务器遇到一个意外的情况,阻止它完成请求。

Exception
org.springframework.web.util.NestedServletException: Request processing failed; nested exception is java.lang.IllegalStateException: A RequestDispatcher could not be located for the default servlet 'org.springframework.web.servlet.resource.DefaultServletHttpRequestHandler'
    org.springframework.web.servlet.FrameworkServlet.processRequest(FrameworkServlet.java:982)
    org.springframework.web.servlet.FrameworkServlet.doGet(FrameworkServlet.java:866)
    javax.servlet.http.HttpServlet.service(HttpServlet.java:634)
    org.springframework.web.servlet.FrameworkServlet.service(FrameworkServlet.java:851)
    javax.servlet.http.HttpServlet.service(HttpServlet.java:741)
    org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:52)
    org.springframework.web.filter.HiddenHttpMethodFilter.doFilterInternal(HiddenHttpMethodFilter.java:93)
    org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:107)


Root Cause
java.lang.IllegalStateException: A RequestDispatcher could not be located for the default servlet 'org.springframework.web.servlet.resource.DefaultServletHttpRequestHandler'
    org.springframework.web.servlet.resource.DefaultServletHttpRequestHandler.handleRequest(DefaultServletHttpRequestHandler.java:124)
    org.springframework.web.servlet.mvc.HttpRequestHandlerAdapter.handle(HttpRequestHandlerAdapter.java:53)
    org.springframework.web.servlet.DispatcherServlet.doDispatch(DispatcherServlet.java:991)
    org.springframework.web.servlet.DispatcherServlet.doService(DispatcherServlet.java:925)
    org.springframework.web.servlet.FrameworkServlet.processRequest(FrameworkServlet.java:974)
    org.springframework.web.servlet.FrameworkServlet.doGet(FrameworkServlet.java:866)
    javax.servlet.http.HttpServlet.service(HttpServlet.java:634)
    org.springframework.web.servlet.FrameworkServlet.service(FrameworkServlet.java:851)
    javax.servlet.http.HttpServlet.service(HttpServlet.java:741)
    org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:52)
    org.springframework.web.filter.HiddenHttpMethodFilter.doFilterInternal(HiddenHttpMethodFilter.java:93)
    org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:107)


)

报错的截图

下面列出项目的一些基本信息:

项目名称SpringMVCProject

springmvc.xml配置文件:




    
    
    
    
    
        
        
    
    
    
    
          
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    

web.xml配置信息:



  SpringMVCProject
  
    index.jsp
  
  
  
  
  
    springDispatcherServlet
    
    org.springframework.web.servlet.DispatcherServlet
    
      
    
        contextConfigLocation
        classpath:springmvc.xml
    
    1
  
  
  
    springDispatcherServlet
    
    /
   
  
  
  
  
    HiddenHttpMethodFilter
    org.springframework.web.filter.HiddenHttpMethodFilter
  
  
  
    HiddenHttpMethodFilter
    /*
  


我是通过配置:

希望达到能够访问image.png的目的:但是没有成功

你可能感兴趣的:(网页访问静态资源问题)