No, you canβt. You can send only one response for each request. The best you can do is use JavaScript to display the originally hidden div or something that contains the message during onclick . But you will have a problem that you cannot hide it whenever the download is complete.
An alternative is to save the file to a temporary disk and return a full JSF response in which you show a download link that returns the file from the temporary disk to a stand-alone servlet.
source share