Hello,
I am working on Fusion Web Application and MySql database. I have created a poi HSSFWorkbook from pivot table and i want to save if from browser.
My code is:
| | ExternalContext ectx = FacesContext.getCurrentInstance().getExternalContext(); |
| | HttpServletResponse response = (HttpServletResponse) ectx.getResponse(); |
| | HttpServletRequest request = (HttpServletRequest) ectx.getRequest(); |
| | OutputStream out = response.getOutputStream(); |
| | String str = "attachment; filename=" + fileName; |
| | response.setHeader("Content-Disposition", str); |
| | response.addHeader("Content-Type", "application/vnd.ms-excel"); |
| | projectWorkbook.write(out); |
| | out.flush(); |
| | out.close(); |
| } catch (IOException e) { | |
| e.printStackTrace(); | |
| } | |
The browser don't show the 'save as' dialog window and i don't found the reason.
If i write the file directly on server, this work.
Can anyone tell me where is the error?
Thanks
Jacques