How to handle static content in Spring MVC?

前端 未结 23 2847
春和景丽
春和景丽 2020-11-22 03:28

I am developing a webapp using Spring MVC 3 and have the DispatcherServlet catching all requests to \'/\' like so (web.xml):

  
          


        
23条回答
  •  滥情空心
    2020-11-22 03:54

    I solved it this way:

    
        Spring MVC Dispatcher Servlet
        /
    
    
        default
        *.jpg
    
    
        default
        *.png
    
    
        default
        *.gif
    
    
        default
        *.js
    
    
        default
        *.css
    
    

    This works on Tomcat and ofcourse Jboss. However in the end I decided to use the solution Spring provides (as mentioned by rozky) which is far more portable.

提交回复
热议问题