I’m using JSF 2.0, and when a form is submitted, I am generating a download. As a result of this, the submission is NOT using AJAX. When the file has been generated for download, I am calling FacesContext.getCurrentInstance().responseComplete(); to tell the browser it’s done.
However, for the sake of User Experience, I want to show a “loading” message on screen when the file is being generated, then remove this message once the download has been generated. Is there a way to do this considering the lack of AJAX?
Thanks,
Chris
Edit:
I am already calling the javascript to show the message onSubmit. My problem is then calling the Javascript to remove the message when the response has completed.
Raise your loading message before submitting the form.
FacesContext.responseComplete()does not send any response to the client. It merely sets a flag in the context to tell the JSF framework that no further lifecycle phases should be processed after the current one completes.