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>

 

posted on 2018-05-15 11:01  shaomine  阅读(2127)  评论(0编辑  收藏  举报