2014-03-03 56 views
0

嗨,我有一個命令按鈕。通知用戶下載已完成。

我正在使用jsf 1.12和tomahwak。我也在客戶端使用jQuery。

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

我的JSF支持bean功能

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

打印的文檔將只需要創建一個文件,並通過設置內容類型,響應等流呢

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

我想能夠在下載開始時顯示消息並在完成時顯示消息

回答

0

Hi th anks找到了我的解決方案。

我改變commandLink比

設置cookie在後臺和使用jquery's file download

相關問題