zoukankan      html  css  js  c++  java
  • JSP中获取项目部署的访问地址

    request.getScheme()://返回当前链接使用的协议;一般应用返回http;SSL返回https;

    request.getServerName()://可以返回当前页面所在的服务器的名字

    request.getServerPort()://可以返回当前页面所在的服务器使用的端口,就是80,

    request.getContextPath()://可以返回当前页面所在的项目的名称名字

    <%
    String path = request.getContextPath();
    String basePath = request.getScheme() + "://" + request.getServerName() + ":" + request.getServerPort()
    + path + "/";
    %>

    使用<%=basePath%>加你存放静态文件的位置,如:/static/upload/file/0cad201dd91d49fda68cbe6eccf24984.png

  • 相关阅读:
    vue
    vue
    vue 中使用style(样式)
    vue 中使用class(样式)
    第17课
    第16课
    第15课
    第14课
    第13课
    第12课
  • 原文地址:https://www.cnblogs.com/foreverstudy/p/11661326.html
Copyright © 2011-2022 走看看