How to handle static content in Spring MVC?

前端 未结 23 2818
春和景丽
春和景丽 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:45

    There's another stack overflow post that has an excellent solution.

    It doesn't seem to be Tomcat specific, is simple, and works great. I've tried a couple of the solutions in this post with spring mvc 3.1 but then had problems getting my dynamic content served.

    In brief, it says add a servlet mapping like this:

    
    default
    /images/*
    
    

提交回复
热议问题