Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
184 views
in Technique[技术] by (71.8m points)

SpringMVC 中 <mvc:resources> 标签的用途

clipboard.png


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)
    <!-- 对静态资源的访问,如 js, css, jpg, png -->
    <!-- 如 HTML 里访问 /js/jquery.js, 则实际访问的是 /WEB-INF/asset/js/jquery.js -->
    <mvc:resources mapping="/js/**"  location="/WEB-INF/asset/js/"  cache-period="31556926"/>
    <mvc:resources mapping="/css/**" location="/WEB-INF/asset/css/" cache-period="31556926"/>
    <mvc:resources mapping="/img/**" location="/WEB-INF/asset/img/" cache-period="31556926"/>
    <mvc:resources mapping="/lib/**" location="/WEB-INF/asset/lib/" cache-period="31556926"/>
    <mvc:resources mapping="/favicon.ico" location="/WEB-INF/asset/img/favicon.ico" cache-period="31556926"/>

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...