我用的是jqury easyui 不知道你用的什么 只要后台代码么 public void exportRoadPassengerReport(HttpServletRequest request, HttpServletResponse response, String titles, String fields) { //这里是取值的 例如String a = request.getParameter("a"); try { List> exportRoadPassengerReportList = this.personalInformationService.findPersonalInformation(a,"","");//这语句是一个查询 你查询出值 List liststr = new ArrayList(); String filename = ""; filename = "人员基本信息"; String[] topTitle = new String[] { "人员基本信息" }; liststr.add(topTitle); liststr.add(titles.split(",")); for (Map map : exportRoadPassengerReportList) { String[] str = new String[titles.split(",").length]; String[] field = fields.split(",");// 获取列对应内容数据 for (int i = 0; i < titles.split(",").length; i++) { str[i] = map.get(field[i]) == null ? "" : map.get(field[i]) .toString(); } liststr.add(str); } File file = ExportXlsUtil.executeCreateXlsFile(liststr, filename, titles.split(",").length - 1); response.setCharacterEncoding("UTF-8"); response.setContentType("multipart/form-data"); response.setHeader("Content-Disposition", "attachment;fileName=" + java.net.URLEncoder.encode(file.getName(), "UTF-8")); if (file != null) { InputStream inputStream = new FileInputStream(file); OutputStream os = response.getOutputStream(); byte[] b = new byte[1024]; int length; while ((length = inputStream.read(b)) > 0) { os.write(b, 0, length); } os.flush(); inputStream.close(); os.close(); } } catch (Exception e) { e.printStackTrace(); } }