-
1. Re: How to open or download Excel file from server in richfa
utdrew Jan 22, 2009 10:44 AM (in response to darmstadter)You need to flush and close your output stream after the loop i.e.
servletOutputStream.flush(); servletOutputStream.close();
Drew -
2. Re: How to open or download Excel file from server in richfa
darmstadter Jan 22, 2009 11:22 AM (in response to darmstadter)thanks for your replay, your are right. the stream must be flushed and closed.
i have tried, but it does not work either.
I have a question yet. After the write, what is happened on the client site? Should it show a download file dialog? -
3. Re: How to open or download Excel file from server in richfa
david.spark Jan 22, 2009 12:10 PM (in response to darmstadter)Have you tried changing your code to
httpServletResponse.setContentType("application/vnd.ms-excel");
This should tell the browser that it's an Excel file (of course the OS on the PC needs to know what to do with .xls files :-)
There's a useful page, http://www.webmaster-toolkit.com/mime-types.shtml, for relating files to their MIME types. -
4. Re: How to open or download Excel file from server in richfa
nbelaevski Jan 22, 2009 7:28 PM (in response to darmstadter)Hi,
Files downloading doesn't work if you use AJAX. Can that be the case? -
5. Re: How to open or download Excel file from server in richfa
darmstadter Jan 23, 2009 3:49 AM (in response to darmstadter)Thanks for your replies. nbelaevski hat right, that file downloading does't work with Ajax. I have tried with a contextMenu, if the user click menuItem, then call the jsFunction to download the file. But it doesn't work. With h:commandButton with action="download()", it works. My new question is, that how to download file with Ajax, it is practicable? or workaround.
-
6. Re: How to open or download Excel file from server in richfa
nbelaevski Jan 23, 2009 7:18 AM (in response to darmstadter)"darmstadter" wrote:
Redirect to the file so that server will issue common HTTP request for it or use "server" modes of rich:* components.
Thanks for your replies. nbelaevski hat right, that file downloading does't work with Ajax. I have tried with a contextMenu, if the user click menuItem, then call the jsFunction to download the file. But it doesn't work. With h:commandButton with action="download()", it works. My new question is, that how to download file with Ajax, it is practicable? or workaround. -
7. Re: How to open or download Excel file from server in richfa
vejnovic Jan 23, 2009 12:44 PM (in response to darmstadter)look this link http://ahoehma.wordpress.com/2008/03/31/jsf-file-download/
-
8. Re: How to open or download Excel file from server in richfa
darmstadter Jan 26, 2009 3:44 AM (in response to darmstadter)Thank nbelaevski and vejnovic.. In ContextMenu and menuItem i have tried with submitMode="server", but it doesn't work