zoukankan      html  css  js  c++  java
  • 在jsp中默认写上的一段java代码表示basePath 的路径的具体的意思是什么?

     <%

        String path = request.getContextPath();

        String basePath = request.getScheme() + "://"

               + request.getServerName() + ":" + request.getServerPort()

               + path + "/";

    %>

    request.getScheme();//可以返回当前页面使用的协议,就是“http”

    request.getServerName();//可以返回当前页面所在的服务器的名字,其实就是一般的localhost,如果是真的部署在服务器上那就是服务器的地址

    request.getServerPort;//返回的是当前页面所在的服务器使用的端口,一般情况下是80端口,(自己的机器测试的话就是8080)

    request.getContextPath;//返回当前页面所在的应用程序的路径,

    这四个拼装起来,就是当前应用的跟路径了。

    <a href="<%=basePath %>/luck/initLuck"   target="blank" style="height:56px"><img src="<c:url value='/images/sign_action/actionButton.png'/>" width="161px" height="56px">

  • 相关阅读:
    unity3D相机缓慢看向目标物体
    设计原则
    unity3D中GUI标题内文字滚动效果
    python3.6中安装PyQt报错
    codeforces 515B.Drazil and His Happy Friends
    HDU 1029 Ignatius and the Princess IV
    POJ 1052 Plato's Blocks
    Uva220 Othello
    uva201 Squares
    uva1587 Box
  • 原文地址:https://www.cnblogs.com/liuhongfeng/p/4543628.html
Copyright © 2011-2022 走看看