wood burning stoves 2.0*
The moose likes JSP and the fly likes Problem with exporting data from JSP to excel sheet Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Murach's Java Servlets and JSP this week in the Servlets forum!
JavaRanch » Java Forums » Java » JSP
Bookmark "Problem with exporting data from JSP to excel sheet" Watch "Problem with exporting data from JSP to excel sheet" New topic
Author

Problem with exporting data from JSP to excel sheet

Karthik Vijayarajan
Ranch Hand

Joined: Mar 13, 2005
Posts: 43
Hi
I am trying to export data from my JSP to an excel sheet.
I used the following code in my JSP.


response.setContentType("application/vnd.ms-excel");
response.setHeader("Content-
disposition", "attachment;filename=ExcelAdjustments.xls");
response.setHeader("Pragma", "public");
response.setHeader("Cache-Control", "max-age=0");

It is working fine sometimes but at times it throws the following error.

Error 500: HTTP/1.1 408 Connection timed out while reading request Server: WebSphere Application Server/5.1 Content-Type: text/html Content-Length: 142 Connection: close

If i remove this,
response.setHeader("Cache-Control", "max-age=0"), i am able to save the excel without any error but i am not able to directly open the excel without saving it.


My browser is IE 5
Please advice.

Thanks
Karthik


Karthik <br />SCJP 1.4 SCWCD 1.4 SCBCD 1.3
 
Don't get me started about those stupid light bulbs.
 
subject: Problem with exporting data from JSP to excel sheet
 
Similar Threads
problem when downloading excel sheet from struts application using Internet explorer
Setting the column width of an Excel
problem in headers and content types
Opening excel sheet separately
remove cache from java code in jsp