Home  >  Q&A  >  body text

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

大家讲道理大家讲道理2743 days ago645

reply all(3)I'll reply

  • 迷茫

    迷茫2017-04-18 10:54:51

        <!-- 对静态资源的访问,如 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"/>
    

    reply
    0
  • 怪我咯

    怪我咯2017-04-18 10:54:51

    The tag in springmvc is mainly for accessing static resources. Specifically, you can download this tag on Baidu and read related blogs to learn more.

    reply
    0
  • PHP中文网

    PHP中文网2017-04-18 10:54:51

    The questioner can try to comment out this configuration code, then the resources under this path will not be accessible.

    reply
    0
  • Cancelreply