在开发中运行的项目打成war 包部署到tomcat 中运行,发现图片引入不到

问题发现:idea 运行访问的路径和打包后运行访问的路径不一样(注意页面用jsp 页面)

问题解决:jsp 页面引入变量url  

<%
    String url=request.getContextPath();
    request.setAttribute("url",url);
%>

引入后${url}

.layui-layout-admin .layui-header {
            background:url(${url}/static/images/header.png) no-repeat center 0;
        }

 

posted on 2018-10-08 13:49  JSBK  阅读(653)  评论(0编辑  收藏  举报