当前位置:主页 > 软件编程 > JSP代码 >

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

时间:2021-02-10 14:48:41 | 栏目:JSP代码 | 点击:

复制代码 代码如下:

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

调用:
复制代码 代码如下:

<%=basePath%>

在js代码里也可以直接用

您可能感兴趣的文章:

相关文章