关于spring-mvc.xml的mvc:resources元素浅析

配置如下:

<!-- 配置静态资源 -->
<mvc:resources location="/static/" mapping="/static/**" />


说明:

location元素表示webapp目录下的static包下的所有文件;

mapping元素表示以/static开头的所有请求路径,如/static/a 或者/static/a/b;

该配置的作用是:DispatcherServlet不会拦截以/static开头的所有请求路径,并当作静态资源

交由Servlet处理。


猜你喜欢

转载自blog.csdn.net/yunxueyouren/article/details/80337835