Hi, I've created a workbook in my JSP and am trying to display the output back in my JSP. But I am getting junk data displayed in my browser. Can someone look at my code and tell me what I'm doing wrong? I've used the same code to write the output to the filesystem and that seems to work fine but I can't seem to write it back to the browser.
Any help would be appreciated. Grace <%@ page import="org.apache.poi.poifs.filesystem.*, org.apache.poi.hssf.usermodel.*, java.io.*, java.util.*" %> <% try { //FileOutputStream out1 = new FileOutputStream("/tmp/gracework.xls"); HSSFWorkbook wb = new HSSFWorkbook(); HSSFSheet s = wb.createSheet(); HSSFRow r = null; HSSFCell c = null; // HSSFCellStyle cs = wb.createCellStyle(); // HSSFDataFormat df = wb.createDataFormat(); wb.setSheetName(0, "one"); for (int rownum=0; rownum<4; rownum++) { r = s.createRow(rownum); for (short cellnum=0; cellnum<5; cellnum++) { c = r.createCell(cellnum); c.setCellValue(cellnum); } } response.setContentType("application/vnd.ms-excel"); response.setHeader("Content-Disposition", "attachment; filename=blah.xls"); ServletOutputStream o = response.getOutputStream(); wb.write(o); o.close(); } catch (Exception e) { e.printStackTrace(); } %> ============================================================================== Please access the attached hyperlink for an important electronic communications disclaimer: http://www.credit-suisse.com/legal/en/disclaimer_email_ib.html ==============================================================================