mercredi 10 juin 2015

It is possible to download file on poll in jsf

I'm trying to download file by poll in jsf.

Here is my code:

<p:commandButton id="sendMessage" value="sendMessage" actionListener="#{logsController.sendMessage}"
<p:poll interval="3" async="false"  immediate="true" listener="#{logsController.downloadAll(null)}" />

and backing bean:

public void sendMessage( ActionEvent event ) {
   {adding message to queue}
}

public void downloadAll( ActionEvent event ) {
   ...
   if(readyToDownload) {
      Faces.sendFile(logFile.getFileByteArray(), "file.txt", true);
   }
}

I wish open up the "save as" dialog but I get only JQuery json parse error.

A content which I'm trying download is a message result from external api, so I can't get this suddenly.

Maybe is another way to solve this problem?

Aucun commentaire:

Enregistrer un commentaire