File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
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
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

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

Shreyaswini Kolali

Joined: Aug 02, 2011
Posts: 3

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.setHeader("Content-Disposition", "attachment; filename=" + excelName );

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

N Sahni
Ranch Hand

Joined: Jul 07, 2011
Posts: 55


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

Thanks and Regards,
Nilesh Sahni | |
vipul bondugula
Ranch Hand

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


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


Vipul Kumar
I agree. Here's the link:
subject: response.setheader("content-disposition") does not work in IE
jQuery in Action, 3rd edition