request.getRealPath("url");//虛擬目錄映射為實際目錄
request.getRealPath("./");//網頁所在的目錄
request.getRealPath("../");//網頁所在目錄的上一層目錄
request.getContextPath();//應用的web目錄的名稱
如
http://localhost:7001/bookStore/
/bookStore/ => [contextPath] (request.getContextPath())
獲取Web項目的全路徑
String strDirPath = request.getSession().getServletContext().getRealPath("/");