Shun 发表于 2021-10-23 17:35:39

jsp文件绝对路径的设置方法


<%
String path = request.getContextPath();
String basePath = request.getScheme() + "://"
+ request.getServerName() + ":" + request.getServerPort()
+ path + "/";//返回形式https://localhost:8080/upload/
>

调用:

<%=basePath%>

在js代码里也可以直接用
https://www.uoften.com/program/jsp/20180413/47762.html
页: [1]
查看完整版本: jsp文件绝对路径的设置方法