关于${pageContext.request.contextPath}的理解
-
${pageContext.request.contextPath}是 JSP 取得绝对路径的方法,等价于<%=request.getContextPath()%>。- 也就是取出部署的 应用程序名 或者是 当前的项目名称
-
比如我的项目名称是
demo1在浏览器中输入为:http://localhost:8080/demo1/a.jsp${pageContext.request.contextPath}取出来的就是/demo1,而"/"代表的含义就是http://localhost:8080- 故有时候项目中这样写
${pageContext.request.contextPath}/a.jsp

浙公网安备 33010602011771号