1、 ${pageContext.request.contextPath}是JSP取得绝对路径的方法,等价于<%=request.getContextPath()%> 。

  也就是取出部署的应用程序名或者是当前的项目名称  

    比如我的项目名称是demo1在浏览器中输入为

        http://localhost:8080/demo1/a.jsp ${pageContext.request.contextPath}或<%=request.getContextPath()%>取出来的就是/demo1,而"/"代表的含义就是http://localhost:8080

       故有时候项目中这样写${pageContext.request.contextPath}/a.jsp

 

2、  去全路径

   jsp页面的地址

  

    <%=basePath%>    http://localhost:8888/demo/     这样可以得到  全路径   

                   如这个例子 :             <%=basePath%>customer/delete   得到的路径为      http://localhost:8888/crm_web/customer/delete     比${pageContext.request.contextPath} 全一些

 

 

 jsp页面的地址

 

相关文章:

  • 2022-12-23
  • 2021-12-26
  • 2022-12-23
  • 2021-12-23
  • 2021-09-24
  • 2022-12-23
  • 2022-12-23
猜你喜欢
  • 2021-10-08
  • 2022-12-23
  • 2022-12-23
  • 2022-02-10
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
相关资源
相似解决方案