2014-03-03 2 views
0

안녕하세요, 저는 명령 버튼이 있습니다.사용자에게 다운로드를 알리는 작업이 완료되었습니다.

저는 jsf 1.12와 tomahwak를 사용하고 있습니다. 나는 또한 클라이언트 쪽에서 jquery를 사용하고있다.

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

내 JSF 백업 빈의 기능을 단지 파일을 생성하고

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

내가 원하는 등 콘텐츠 유형, 응답을 설정하여 스트리밍 할

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

인쇄 문서 다운로드가 시작될 때 메시지를 표시하고 완료되면 메시지를 표시 할 수 있습니다.

답변

0

안녕하세요. anks는 나의 해결책을 발견했다. 내가

보다 CommandLink는 변경

은 백엔드에서 쿠키를 설정하고 jquery's file download

를 사용
관련 문제