HTML和JSP中获取项目根路径

时间:2022-02-09 18:44:51

前台界面项目根路径获取和使用


HTML中获取项目根路径的方法background-image: url(${request.contextPath}/before/images/image_3.jpg);


JSP中获取项目根路径的方法background-image: url(${pageContext.request.contextPath}/before/images/image_3.jpg)


<link rel="stylesheet" href="${request.contextPath}/before/css/showBo.css">
<script src="${request.contextPath}/before/js/jquery-3.2.1.min.js"></script>