springmvc+jsp引用本地图片文件

  1、图片文件路径,注意图片文件夹和WEB-INFO文件夹同级

    

  2、web.xml配置

  

 <servlet-mapping>
    <servlet-name>default</servlet-name>
    <url-pattern>*.png</url-pattern>
  </servlet-mapping>

  3、spring-web.xml配置

<mvc:resources location="/image/" mapping="/image/**" />

  4、jsp引用

  

<style type="text/css">
            body 
            {
                background-image:url('${pageContext.request.contextPath}/image/bimag1.png');
                background-color:#cccccc;
            }
        </style>

猜你喜欢

转载自www.cnblogs.com/shaosks/p/9039869.html