Pergunta

Hi i have a command button.

I am using jsf 1.12 and tomahwak. I also am using jquery on client side.

<h:commandButton type="submit" value="Download Receipt" 
                 onclick="refresh();" 
                 id="downloadDocument"
                 actionListener="#{transactionPage.downloadReceipt}" 
                 immediate="true"
                 /> 

My jsf backing bean function

public void downloadReciept(final ActionEvent event) {
    try{
        DocManager docManager = new DocManager();
        docManager.printDocs();
    }catch (Exception e) {
        log.error("Fail to download document!", e);
    }
}

print docs would just create a file and stream it by setting the content-type, response, etc.

        File sourceFile = createDoc();
        Url url         = sourceFile.toURI().toURL();
        streamDoc(url);

I want to be able to display a message when downloading is starting and message when it finished

Nenhuma solução correta

Outras dicas

Hi thanks found my solution.

I change to commandLink than

set the cookie in backend and use jquery's file download

Licenciado em: CC-BY-SA com atribuição
Não afiliado a StackOverflow
scroll top