You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
|
|
|
|
<%--
|
|
|
|
|
Created by IntelliJ IDEA.
|
|
|
|
|
User: jhu
|
|
|
|
|
Date: 2020/10/5
|
|
|
|
|
Time: 11:06
|
|
|
|
|
To change this template use File | Settings | File Templates.
|
|
|
|
|
--%>
|
|
|
|
|
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
|
|
|
|
|
<%
|
|
|
|
|
// 获取当前请求的协议(如http或https)
|
|
|
|
|
String scheme = request.getScheme();
|
|
|
|
|
// 获取服务器的主机名或IP地址
|
|
|
|
|
String serverName = request.getServerName();
|
|
|
|
|
// 获取服务器的端口号
|
|
|
|
|
int serverPort = request.getServerPort();
|
|
|
|
|
// 获取当前应用的上下文路径
|
|
|
|
|
String contextPath = request.getContextPath();
|
|
|
|
|
|
|
|
|
|
// 拼接basePath,用于构建项目的根路径
|
|
|
|
|
String basePath = scheme + "://" + serverName + ":" + serverPort + contextPath + "/";
|
|
|
|
|
|
|
|
|
|
// 将basePath存储到pageContext中,方便在页面中使用
|
|
|
|
|
pageContext.setAttribute("basePath", basePath);
|
|
|
|
|
%>
|
|
|
|
|
|
|
|
|
|
<!-- 写base标签,永远固定相对路径跳转的结果 -->
|
|
|
|
|
<base href="<%=basePath%>">
|
|
|
|
|
|
|
|
|
|
<!-- 引入外部的CSS样式文件 -->
|
|
|
|
|
<link type="text/css" rel="stylesheet" href="static/css/style.css">
|
|
|
|
|
|
|
|
|
|
<!-- 引入外部的jQuery库 -->
|
|
|
|
|
<script type="text/javascript" src="static/script/jquery-1.7.2.js"></script>
|