I am trying to create an xls file through java code and allow the user to download it. The download code is in JSP and it works well in IE9 and other browsers. But it gives an error in IE 8 like "The file cannot be downloaded. This website cannot be opened. The requested site is either unavailable or cannot be found. Please try again later."
my JSP code is as follows.
<%@ page import="org.apache.poi.ss.usermodel.Workbook"%><%@ page import="java.io.*"%> <%response.setHeader("Pragma","no-cache"); response.setHeader("Content-disposition", "attachment;filename=DataTemplate.xls"); response.setContentType("application/vnd.ms-excel"); OutputStream os = response.getOutputStream(); ((Workbook)request.getAttribute("result")).write(os); os.flush();os.close();%>
I checked all the settings for IE, as suggested by Microsoft sites. Other users' suggestions on the Internet is reinstalling IE8, but it doesn't seem good to me as I get this problem on multiple machines.
Any help is appreciated.
Thanks.
Coder source share