ファイルをダウンロードする必要があるため(h:commandButtonでしかできないため)少し問題がありますが、oncomplete関数が必要です(a4j: commandButton)を実行ステータスにします。 コードのサンプルはこれです:h:commandButton oncomplete関数を使用してファイルをダウンロードする
<h:commandButton
id="downloadReportButton"
action="#{reportingBean.createAndDonwloadFile()}"
/>
私はすでにBalusCすることにより、この応答のようにそれをやろう:https://stackoverflow.com/a/31267418/1777424しかし問題は、実行されていないAjaxリクエストです。
<h:commandButton
id="downloadReportButton"
action="#{reportingBean.createAndDonwloadFile()}"/>
<f:ajax onevent="oneventFunction" />
</h:commandLink>
function oneventFunction(data) {
if (data.status === "success") {
oncompleteFunction();
}
}