获得ip,端口后及项目名,返回一个basePath
<%
String path = request.getContextPath();
String basePath = request.getScheme()+"😕/"+request.getServerName()+":"+request.getServerPort()+path;
System.out.println(“basePath:”+basePath);
%>
js中使用basePath:
var basePath = “<%=basePath %>”;
本文介绍了一种在Java中获取项目basePath的方法,通过拼接请求方案、服务器名称、端口及项目路径,返回完整的basePath,便于在JS中调用。
891

被折叠的 条评论
为什么被折叠?



