导出csv 随便记录

HttpServletResponse rsp = ServletActionContext.getResponse();
OutputStream os = rsp.getOutputStream();
rsp.setContentType("application/vnd.ms-excel");
String filedisplay = new String("人员导出".getBytes("gb2312"), "iso8859-1");
rsp.addHeader("Content-Disposition", "attachment;filename="
+ filedisplay + ".csv");
StringBuffer buffer = new StringBuffer();
buffer.append("组织机构,姓名,身份证号,警号,性别,出生日期,政治面貌,民族,学历,学位,办公室电话,办公专线,手机1,手机2,电子邮箱1,电子邮箱2,人员类型,工作单位,所在处(科)室,入警时间,职称,职务,级别,警衔,警种,所在部门,岗位,证书");
buffer.append("\r\n");
os.write(buffer.toString().getBytes("gb2312"));
os.flush();

posted @ 2019-12-03 09:52  无知死循环  阅读(190)  评论(0编辑  收藏  举报