java 导出csv
//导出数据集合,用逗号分割的数据
//导出数据集合,用逗号分割的数据
List<String> dataList = new ArrayList<String>(); //遍历集合,瓶装到stringBufferfor (String item : dataList) { exportString.append(item).append("\n"); }writeJsonCsv(response, exportString.toString());public void writeJsonCsv(HttpServletResponse response, String json) { try { response.setContentType("application/csv;charset=gb18030"); Writer writer = response.getWriter(); writer.write(json); writer.flush(); writer.close(); } catch (Exception e) { logger.error("writeJsonCsv异常", e); } }