How to handle static content in Spring MVC?

前端 未结 23 2831
春和景丽
春和景丽 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 04:00

    This can be achieved in at least three ways.

    Solutions:

    • expose the html as a resource file
    • instruct the JspServlet to also handle *.html requests
    • write your own servlet (or pass to another existing servlet requests to *.html).

    For complete code examples how to achieve this please reffer to my answer in another post: How to map requests to HTML file in Spring MVC?

提交回复
热议问题