How to set the absolute path of JSP file

Time:2020-10-23
Copy codeThe code is as follows:
<%
String path = request.getContextPath();
String basePath = request.getScheme() + “://”
+ request.getServerName() + “:” + request.getServerPort()
+Path + “/”; / / return form http://localhost :8080/upload/
>

Call:

Copy codeThe code is as follows:
<%=basePath%>

It can also be used directly in JS code

Recommended Today

Blog based on beego, go blog

Go Blog A beego based development, can quickly create personal blog, CMS system Include functions see Official website of go bloggo-blog.cn Demo siteleechan.online Update log time function January 23, 2020 New top post function February 2, 2020 New custom navigation function February 4, 2020 New site announcement function February 6, 2020 New link module February […]