从一个jsp的查询网址导出查询到的数据 jsp 网站 导出 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 用的poiHttpServletRequest request = ServletActionContext.getRequest(); HttpServletResponse response = ServletActionContext.getResponse(); ByteArrayOutputStream bao = null; HSSFWorkbook workbook = new HSSFWorkbook(); HSSFSheet sheet; HSSFRow row; HSSFCell cell; sheet = workbook.createSheet(); row = sheet.createRow(0); cell = row.createCell(0); cell.setCellValue("第一行第一列"); cell = row.createCell(1); cell.setCellValue("第一行第二列"); cell = row.createCell(2); cell.setCellValue("第一行第三列"); cell = row.createCell(3); cell.setCellValue("第一行第四列"); cell = row.createCell(4); cell.setCellValue("第一行第五列"); cell = row.createCell(5); cell.setCellValue("第一行第六列"); for (int i = 0; i < 30000; i++) { row = sheet.createRow(i + 1); cell = row.createCell(0); cell.setCellValue("123"); cell = row.createCell(1); cell.setCellValue("123"); cell = row.createCell(2); cell.setCellValue("123"); cell = row.createCell(3); cell.setCellValue(""); cell = row.createCell(4); cell.setCellValue(""); cell = row.createCell(5); cell.setCellValue("123"); } SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd"); response.setContentType("application/octet-stream"); response.setHeader("Content-length", workbook.getBytes() + ""); String filename = new String((sdf.format(new Date()) + "tt.xls") .getBytes("GBK"), "iso8859-1"); response.setHeader("Content-disposition", "attachment; filename=" + filename); OutputStream reponseOs = response.getOutputStream(); workbook.write(reponseOs); reponseOs.flush(); reponseOs.close(); response.flushBuffer(); java中使用memcache的问题 请教牛顿迭代法的C++的实现程序 在jsp 页面中的标签中 怎么写javascript脚本 PreparedStatement对象方法的奇怪问题 代码规范器? 探讨使用java代码,还是使用标签库实现jsp动态内容显示! 请大家参与讨论^-^ 急啊!!再次求助!! 急啊,关于javascript document.write 的问题,请帮忙~ 谁能看懂jsp的错误信息呀,帮我看看 有关于get和post在Tomcat中! java 实现多张表分页 不是多表关联查询 SSH整合求助~~
用的poiHttpServletRequest request = ServletActionContext.getRequest();
HttpServletResponse response = ServletActionContext.getResponse();
ByteArrayOutputStream bao = null;
HSSFWorkbook workbook = new HSSFWorkbook();
HSSFSheet sheet;
HSSFRow row;
HSSFCell cell;
sheet = workbook.createSheet();
row = sheet.createRow(0);
cell = row.createCell(0);
cell.setCellValue("第一行第一列");
cell = row.createCell(1);
cell.setCellValue("第一行第二列");
cell = row.createCell(2);
cell.setCellValue("第一行第三列");
cell = row.createCell(3);
cell.setCellValue("第一行第四列");
cell = row.createCell(4);
cell.setCellValue("第一行第五列");
cell = row.createCell(5);
cell.setCellValue("第一行第六列");
for (int i = 0; i < 30000; i++) {
row = sheet.createRow(i + 1);
cell = row.createCell(0);
cell.setCellValue("123");
cell = row.createCell(1);
cell.setCellValue("123");
cell = row.createCell(2);
cell.setCellValue("123");
cell = row.createCell(3);
cell.setCellValue("");
cell = row.createCell(4);
cell.setCellValue("");
cell = row.createCell(5);
cell.setCellValue("123");
} SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
response.setContentType("application/octet-stream");
response.setHeader("Content-length", workbook.getBytes() + "");
String filename = new String((sdf.format(new Date()) + "tt.xls")
.getBytes("GBK"), "iso8859-1");
response.setHeader("Content-disposition", "attachment; filename="
+ filename);
OutputStream reponseOs = response.getOutputStream();
workbook.write(reponseOs);
reponseOs.flush();
reponseOs.close();
response.flushBuffer();