-
1. richfaces download file
ilya40umov Jan 22, 2011 3:00 AM (in response to saurabh0011)1) If your code does not generate this file I think that you should better put it to Apache server.
2) If your code generates this file you should use h:commandButton(not a4j) and write it into response.
Something like it's desribed here:
http://www.coderanch.com/t/212339/JSF/java/Exporting-csv-file-JSF
-
2. richfaces download file
boy18nj Jan 23, 2011 2:52 PM (in response to saurabh0011)Hi Saurabh,
Unfortunately there is no such component which helps you to download the file.
You can either 1) -> make a hyperlink to the file (common case) 2) -> point a link to a servlet that will return the file as stream
But we do have jsf component to upload the file namely s:fileUpload.
-
3. richfaces download file
saurabh0011 Jan 24, 2011 12:21 AM (in response to boy18nj)Thanks to reply
-
4. Re: richfaces download file
asatishkumar Feb 7, 2012 4:30 PM (in response to ilya40umov)Ilya - when I follow the approach recommended by http://www.coderanch.com/t/212339/JSF/java/Exporting-csv-file-JSF, the file is automatically opened by IE. How do I not lose the page that we are on and present a download dialog box?
-
5. Re: richfaces download file
pjotrovsky Feb 9, 2012 7:25 AM (in response to asatishkumar)You can use window.open(URL_OF_DOCUMENT, '_blank')
-
6. Re: richfaces download file
asatishkumar Feb 9, 2012 8:46 AM (in response to pjotrovsky)The problem with this approach is, the JSF state wouln't be maintained in the URL, so I have requery the database to get the results which I am trying to avoid. If I have to requery then I would accomplish this very easily using a directly servlet mapping instead of going through JSF lifecyle.