Hi there,
My users want also to be able to download Excel files generated on the fly by the application. For me, until now, it doesn't work at all on IE, Firefox does ask the user to download the file almost no matter what I do, but not IE. It keeps saying: "IE could not download doExport.jsf from localhost...."; (i've been trying all sort of combinations of mime types and content dispositions...)
I use a servlet to respond back with byte data and custom mime type. I redirect to something like /user/export/doExport.xls which is mapped to a servlet...Do you have any ideea about what could be wrong with this?
Is it possible to write a custom JSF component that performs the Excel generation and streaming? something like, for a dataTable when clicked generate an Excel file with the same columns and aks user to save...what will it take to make something like this? a custom renderer kit too?
Thanks,
Catalin
Bruno Aranda <[EMAIL PROTECTED]> wrote:
My users want also to be able to download Excel files generated on the fly by the application. For me, until now, it doesn't work at all on IE, Firefox does ask the user to download the file almost no matter what I do, but not IE. It keeps saying: "IE could not download doExport.jsf from localhost...."; (i've been trying all sort of combinations of mime types and content dispositions...)
I use a servlet to respond back with byte data and custom mime type. I redirect to something like /user/export/doExport.xls which is mapped to a servlet...Do you have any ideea about what could be wrong with this?
Is it possible to write a custom JSF component that performs the Excel generation and streaming? something like, for a dataTable when clicked generate an Excel file with the same columns and aks user to save...what will it take to make something like this? a custom renderer kit too?
Thanks,
Catalin
Bruno Aranda <[EMAIL PROTECTED]> wrote:
I've not experiencing this in firefox, so maybe is a IE only issue? I
am using the same code pattern,
Regards,
Bruno
2005/12/9, CONNER, BRENDAN (SBCSI):
> We have a curious problem in our JSF application that did not appear in
> an equivalent Struts application: When we write contents to the response
> to be downloaded to the client (e.g., a comma-delimited .csv file), the
> browser pop-up that asks the user whether the user wants to "open" or
> "save" the file appears a second time after the user chooses "open."
> Thus, the user has to click on the "open" button twice to open the
> downloaded file.
>
> A description of the problem (along with a workaround) is at
> http://www.rpmsoftware.com/wiki/index.php/Download_asks_twice
>
> The work-around given in the description requires the user to modify
> his/her settings, which is unacceptable for our application (especially
> since our application is the only one exhibiting this behavior). I'm
> trying to find out what is causing this behavior to try to see how to
> address it.
>
> Here's a summary of some test code used to do the file export:
>
> response.setContentType("application/excel");
> response.setHeader("Content-Disposition", "multi-part
> attachment;filename=\"" + defaultFileName + "\";");
> PrintStream os = new PrintStream(((ServletResponse)
> response).getOutputStream());
> byte[] byte_1darray = {'1', '2', '3'};
> os.write(byte_1darray, 0, 3);
>
> facesContext.getApplication().getStateManager().saveSerializedView(faces
> Context);
> facesContext.responseComplete();
>
> Note that I also tried setting the content type to text.html, but the
> result was the same.
>
> Has anyone else experienced this problem? Can anyone explain what is
> going on?
>
> - Brendan
>
Yahoo! Shopping
Find Great Deals on Holiday Gifts at Yahoo! Shopping

