I am trying to open a excel through the Java code in struts Framework. The Piece of code I am using for this is: response.setContentType(CONTENT_TYPE_XLS); StringBuffer sbContentDisp = new StringBuffer(); sbContentDisp.append(CONTENT_DISPOSITION_INLINE_FILENAME); sbContentDisp.append(FILE_PREFIX); sbContentDisp.append(System.currentTimeMillis()); sbContentDisp.append(DOT); sbContentDisp.append(sFileType); response.setHeader(HEADER_CONTENT_DISPOSITION_TAG, sbContentDisp.toString()); response.flushBuffer(); ServletOutputStream sosStream = response.getOutputStream(); sosStream.write(tableData.getBytes());
I am using Internet Explorer for opening the new xls in new Browser of Internet Explorer. But when the page is opening in the new Browser, I am getting the Exception "The page cannot be opened" since the Checkbox in the browser properties "Do not save encrypted pages to disk". Hence this is not being downloaded. Can anyone tell me how to avoid this since I have seen internet webpages downloading though this is checked in my browser.