jsp项目路径

获取项目在硬盘的绝对路径

<%

request.getRealPath("/");

%>

获取项目的http路径

<%
String path = request.getContextPath();
String basePath = request.getScheme() + "://"
+ request.getServerName() + ":" + request.getServerPort()
+ path + "/";
%>

破罐子互摔
原文地址:https://www.cnblogs.com/zonglonglong/p/2668305.html