再做一个HR系统的时候,需求要将页面的数据导出,是Excel文件的形式,请哪位高手指点!以前没这样做过!谢谢!!!
扣扣号: 403645933
扣扣号: 403645933
解决方案 »
- ibates和sping的事务问题
- heritrix获取动态页面的问题(jsp.asp等)
- 未登陆用户验证问题
- tomcat5.0.27+jdk1.4.2+axis1.4部署求教(The requested resource (/axis/) is not available.)
- 求问一个 简单的xml解析问题
- 急求高手,有酬求助
- gcc命令的使用
- JBoss OpenTool出了新最新版2.6,可以更好的支持JBOSS 3.2
- 关于CMP的问题
- logstash与spring boot整合,向kafka发送消息,怎么做?
- 高分求助:使用javamail包为什么会打印邮件内容到控制台?,有答案马上结贴!
- JSF用的还多吗?
ArrayList alllist= (ArrayList)request.getAttribute("alllist");
request.getSession().setAttribute("alllist",alllist);
ArrayList tlist= (ArrayList)request.getAttribute("tlist");
request.getSession().setAttribute("tlist",tlist);
request.getSession().setAttribute("type",type); %>
location="<%=path%>/main/exl/exl.jsp";
}
打印界面exl.jsp
<%
response.setHeader("Pragma","No-cache");
response.setHeader("Cache-Control","no-cache");
response.setDateHeader("Expires", 0);
response.addHeader("Content-Disposition", "filename=userinfo.xls");
int i = 0;
ArrayList<Exl> item = (ArrayList<Exl>)request.getSession().getAttribute("alllist");
ArrayList<Type> tlist = (ArrayList<Type>)request.getSession().getAttribute("tlist");
%>
其他的都一样
response.setHeader("Content-Disposition", "attchment;filename=abc.xls");
HSSFWorkbook book = new HSSFWorkbook();
HSSFSheet sheet = book.createSheet();
HSSFRow row = sheet.createRow(0);
HSSFCell cell = row.createCell((short)0);
cell.setCellValue(new HSSFRichTextString("xxxxxxxxxx"));
book.write(response.getOutputStream());
{ "操作人", "日志类型", "操作", "操作对象", "操作时间", "登陆ip" });csv.writeRecord(new String[]
{"hello","测试","测试","hello","2011-12-29","127.0.0.1" });csv.flush();