0

I need to implement a file download functionality for my application. I followed this example Forcing a save as dialogue from any web browser from JSF application but the save dialog never appears while the code executes normally. After I looked at my http response I saw that is wrapped in a pretty faces response since I'm also using pretty faces. Is there something I should change to make it work with pretty faces (assuming that is the reason for not working)?

EDIT:

It seems that the problem was not Pretty Faces but Icefaces. By just adding the icefaces libraries to my application the download method does not work and the dialog never appears. By removing it it works. Any ideas?

Community
  • 1
  • 1
user579674
  • 2,159
  • 6
  • 30
  • 40
  • Have you considered [ice:outputResource](http://icefaces-showcase.icesoft.org/showcase.jsf;jsessionid=D91E1EEDF6C7564BD02C8A822271C0F9?grp=compatMenu&exp=outputResource)? – StockB Jul 27 '12 at 13:46

1 Answers1

0

I don't think that PrettyFaces is the reason for this not working. PrettyFaces only modifies the response.encodeURL() and response.encodeRedirectURL() methods for rendering links.

Most people do downloads using a custom servlet, however you can do these things with JSF, it just takes some fiddling around and tweaking.

This is an example of doing something similar using PrettyFaces: http://ocpsoft.org/prettyfaces/serving-dynamic-file-content-with-prettyfaces/

Lincoln
  • 3,151
  • 17
  • 22
  • I saw that example before but in my application I do not want to do it using URL's I want it to be a method called as an action of a commandLink/commandButton. I tried many different things I found around but the dialog just does not show up. – user579674 Jul 25 '12 at 12:11