<%
String basePath = request.getScheme()
+ "://"
+ request.getServerName()
+ ":"
+ request.getServerPort()
+ request.getContextPath()
+ "/";
%>
<!--写base标签,永远固定相对路径跳转的结果-->
<base href="<%=basePath%>">
getScheme | 返回用于发出此请求的方案的名称,例如 不同方案具有不同的构造 URL 的规则,这一点已在 RFC 1738 中注明。 | Returns the name of the scheme used to make this request, for example, Different schemes have different rules for constructing URLs, as noted in RFC 1738. |
getServerName | 返回请求被发送到的服务器的主机名。它是 | Returns the host name of the server to which the request was sent. It is the value of the part before ":" in the |
getServerPort | 返回请求被发送到的端口号。它是 | Returns the port number to which the request was sent. It is the value of the part after ":" in the |
getContextPath | 返回请求 URI 指示请求上下文的那一部分。请求 URI 中首先出现的总是上下文路径。路径以 "/" 字符开头但不以 "/" 字符结束。对于默认(根)上下文中的 servlet,此方法返回 ""。容器不会解码此字符串。 | Returns the portion of the request URI that indicates the context of the request. The context path always comes first in a request URI. The path starts with a "/" character but does not end with a "/" character. For servlets in the default (root) context, this method returns "". The container does not decode this string. |