File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes Servlets and the fly likes response.setheader( 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 » Servlets
Bookmark "response.setheader("content-disposition") does not work in IE" Watch "response.setheader("content-disposition") does not work in IE" New topic
Author

response.setheader("content-disposition") does not work in IE

Shreyaswini Kolali
Greenhorn

Joined: Aug 02, 2011
Posts: 3
Hi,

My piece of code is as follows where the file name is generated dynamicsally each time based on the users' input.
The code executes very well in Firefox & chrome. But in IE when i try to open the excel sheet that is exported, the name of the file remains same as the servelet name.

String excelName = Util.getExcelName(entityType, entityName, effectiveDate);
response.reset();
response.setContentType("application/x-download");
response.setHeader("Content-Disposition", "attachment; filename=" + excelName );

Can anyone please help me with this issue.? It is specific to only IE.

Thanks,
Shreya
N Sahni
Ranch Hand

Joined: Jul 07, 2011
Posts: 55

Hi,

Which version of IE you are using. I think this issue is no longer visible in IE8 and later.


Thanks and Regards,
Nilesh Sahni | nsahni@infocepts.com | www.infocepts.com
vipul bondugula
Ranch Hand

Joined: Oct 14, 2010
Posts: 218
Hi Shreyaswini,

response.setContentType("application/x-download");


Replace with this code
response.setContentType("application/vnd.ms-excel");.Once try this.May be this will be helpful for your scenario..

Cheers...

Thanks
Vipul Kumar
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: response.setheader("content-disposition") does not work in IE
 
Similar Threads
Content-Disposition: Download file name problem
Download the .lzh file with prompting file save dialog
response.setHeader("Content-Disposition") not working in IE alone
java.lang.IllegalStateException:- when generating excel report
Problem with sending plain text