System.out.println("根目錄所對應的絕對路徑:" + request.getServletPath() + ""); 
String strPathFile 
= request.getSession().getServletContext().getRealPath(request.getRequestURI()); 
System.out.println(
"文件的絕對路徑:" + strPathFile + ""); 
String strDirPath 
= new File(request.getSession().getServletContext().getRealPath(request.getRequestURI())).getParent(); 
System.out.println(
"目錄的絕對路徑:" + strDirPath + ""); 
    this.getServlet().getServletContext().getRealPath("/");//在struts的action中取得當前系統的根目錄

 舉例:http://localhost:7001/myservlet/somepath/test?someparam=somevalue
request.getPathInfo():返回
/somepath/test
request.getRequestURL():返回http:
//localhost:7001/myservlet/somepath/test
request.getRequestURI():返回/myservlet/somepath/test
request.getServletPath():返回
/myservlet
request.getQueryString():返回someparam
=somevalue
    request.getContextPath();  返回項目名/myservlet