<%
String WEB_APP = request.getContextPath();
request.setAttribute("WEB_APP", WEB_APP);
%>例如:
你的地址为:http://localhost:8080/project_web/homePage/createExcel.do;
<a href="${WEB_APP}/homePage/createExcel.do">生成excel</a>相当于
<a href = "project_web/homePage/createExcel.do">生成excel</a>
本文介绍了一种在JSP页面中利用EL表达式简化URL路径的方法,通过设置请求属性WEB_APP来实现相对路径引用,方便进行页面跳转及资源链接。
1786





