Get the tools you need to learn Java skills fast!
Video tutorials, eBooks, hands-on lab exercises, sample code.
Get started
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 The Software Craftsman this week in the Agile 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

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: 218
Hi Shreyaswini,


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


Vipul Kumar
Have you tried LearnNowOnline?
subject: response.setheader("content-disposition") does not work in IE