String basePath = this.request.getScheme() + "://" + this.request.getServerName() + ":" + this.request.getServerPort()+this.request.getContextPath();//例如:http://localhost:8080/Test虚拟路径 String realPath = ServletActionContext.getServletContext().getRealPath("images\\fanhui");//物理路径 例:C:Tomact/webapps/Test/images/fanhui