${pageContext.request.contextPath}的作用

来源:互联网 发布:sqlserver格式化工具 编辑:程序博客网 时间:2024/05/07 22:08

${pageContext.request.contextPath}等价于<%=request.getContextPath()%> 或者可以说是<%=request.getContextPath()%>的EL版 意思就是取出部署的应用程序名或者是当前的项目名称

比如我的项目名称是ajax01 在浏览器中输入为http://localhost:8080/ajax01/login.jsp ${pageContext.request.contextPath}或<%=request.getContextPath()%>取出来的就是/ajax01,而"/"代表的含义就是http://localhost:8080

所以我们项目中应该这样写${pageContext.request.contextPath}/login.jsp

0 0