String filePath = this.getServlet().getServletContext().getRealPath("/XXX/XXX/XXX.xls"); 其中/XXX/XXX/XXX.xls 表示在web中的路劲及文件名