Skip to Main Content

Java EE (Java Enterprise Edition) General Discussion

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

jsp data in Excel

843836Dec 30 2003 — edited Jul 22 2008
Hi,
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.
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Aug 19 2008
Added on Dec 30 2003
20 comments
1,018 views