/*** csv 导出*/public static<T> void exportCsvFile(HttpServletResponse response, List<T> list) throws Exception{response.setHeader("content-Type", "text/csv");response.setHeader("Content-Disposition", "attachment;filename=" + URLEncoder.encode("测试" + ".csv", "utf-8"));//导出csv乱码,设置ServletOutputStream outputStream = response.getOutputStream();outputStream.write(new byte[]{(byte)0xEF, (byte)0xBB, (byte)0xBF});CsvExportParams csvExportParams = new CsvExportParams();csvExportParams.setEncoding("utf-8");outputStream.flush();CsvExportUtil.exportCsv(csvExportParams, User.class,list, outputStream);}
1500字范文,内容丰富有趣,写作好帮手!