jsp项目路径

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

<%

request.getRealPath("/");

%>

获取项目的http路径

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

posted @ 2012-09-03 09:52  西瓜霜  阅读(154)  评论(0编辑  收藏  举报