Java code
?
1
2
3
4
String path = request.getContextPath();
String basePath = request.getScheme() +
"://"
+ request.getServerName() +
":"
+ request.getServerPort()
+ path +
"/"
;
再在JS中调用:
JavaScript code
?
1
2
var
basePath =
'<%=basePath%>'
;
alert(basePath);
//http://localhost:8080/
转载请注明原文地址: https://www.6miu.com/read-12941.html