jsp data in Excel
843836Dec 30 2003 — edited Jul 22 2008Hi,
I want to export the contents of html page(JSP) to Excel.The jsp page will be displayed on the browser and on the click of a button I need to export the data into excel.On my page I have charts and also normal tables.
I have tried doing this but I'm getting illegalStateException..may be bcoz its already written the jsp page and I'm trying to write the same thing again ...
First of all is it possible to write the contenets of this html page into an Excel sheet???
Can u plz help.I'm using Jakartas POI for this....
The code whcih I have written is like this....
HSSFWorkbook wb = new HSSFWorkbook();
HSSFSheet s = wb.createSheet();
response.setContentType("application/vnd.ms-excel");
response.setHeader("Content-Disposition","attachment; filename =unknown.xls");
OutputStream out = response.getOutputStream();
wb.write(out);
out.close();
Thanks.