获取路径path

request 的常用方法

  • request.getSchema()
    返回当前页面使用的协议,http 或是 https;
  • request.getServerName()
    返回当前页面所在的服务器的名字;
  • request.getServerPort()
    返回当前页面所在的服务器使用的端口,就是80;
  • request.getContextPath()
    返回当前页面所在的应用的名字;

jQuery

  • 获取当前根目录
${pageContext.request.contextPath}

${ctx}
<!-- 简写形式 -->

el

${pageContext.request.contextPath}
原文地址:https://www.cnblogs.com/52liming/p/7692107.html