作者:mobiledu2502860837 | 来源:互联网 | 2023-07-23 07:53
<%@ page language="java" cOntentType="text/html; charset=UTF-8"
pageEncoding="UTF-8"%>
<%
//项目的发布路径,例如: /rabc
String path = request.getContextPath();
System.out.println(path);
/*
全路径,形式如下: http://127.0.0.1:8001/rbac/
request.getScheme() ——> http 获取协议
request.getServerName() --> 127.0.0.1 获取服务名
request.getServerPort() --> 8001 获取端口号
path --> /rbac 获取访问的路径 路
*/
String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";
System.out.println(basePath);
%>