您的位置:首页 > 产品设计 > UI/UE

request中getContextPath、getServletPath的区别

2016-10-19 11:51 405 查看
  

访问:http://localhost:8080/app/testJsp.jsp

  <%=request.getContextPath()%> ·<!-- 返回站点的根路径。 -->      /app

  <%=request.getServletPath()%>   /testJsp.jsp

  <%=request.getRequestURI()%>  /app/testJsp.jsp

  <%=request.getRealPath("/")%>  <!-- 工程文件的实际物理路径 -->   E:\计算机视频\验证码\app\WebRoot\

 

  <%=request.getScheme() %>
<!-- 返回当前页面使用的协议,http 或是 https-->

  <%=request.getServerName()%>  <!-- 返回当前页面所在的服务器主机的名字; -->

  <%=request.getServerPort()%>    <!--  返回服务器接受此请求所用的端口号 -->
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: 
相关文章推荐