一.jsp
a.<%=request.getContextPath()%>//结果:/projectName
b.${pageContext.request.contextPath}//结果:/projectName
用法:
<link rel="stylesheet" type="text/css" href="${pageContext.request.contextPath}/order/css/OrderCss.css" />
<link rel="stylesheet" type="text/css" href=<%=request.getContextPath()%>+"/order/css/OrderCss.css" />
二.js
a.'${pageContext.request.contextPath}'//结果:/projectName
b.'<%=request.getContextPath()%>'//结果:/projectName
用法:
<script>
function searchData(dom){
$(dom).attr('disabled', true);
var url = '${pageContext.request.contextPath}/OrderController/getOrders.jsp?'+$('#orderForm').serialize();
var url = '<%=request.getContextPath()%>'+'/OrderController/getOrders.jsp?'+$('#orderForm').serialize();
$('#dataDiv').html('数据加载中...').load(url, function(){
$(dom).attr('disabled', false);
});
}
<script>