当前WEB应用的物理路径:<%=application.getRealPath("/")%>
当前访问的JSP文件的物理路径:<%=application.getRealPath(request.getRequestURI())%& gt;
当前访问jsp文件的所在目录的物理路径: <%
String path=application.getRealPath(request.getRequestURI());
String dir=new java.io.File(path).getParent();
out.println("dir);
%>
request.getRequestURI() 返回值类似:/myContext/requestdemo.jsp
返回值是String request.getRequestURL() 返回值类似:http://localhost:8080/myContext/requestdemo.jsp
返回值是StringBuffer