1
Primefaces monitorDownload(PF 3.4.2)での使用に直面しています。Primefaces monitor起動機能の直後に火災が発生する
ファイルを作成し、commandButtonでダウンロードしたいと考えています。ボタンをクリックすると、開始機能の直後に停止機能が起動します。その後、世代+ダウンロード要求は適切に行われます。したがって、終了機能はダウンロード終了時に開始されるのではなく、開始機能と同じ瞬間に起動されます。
私がしたいとは思っていません。私はこのシナリオたい:
- クリック
- ロード糸車が表示されたボタンを、ファイルの
- ジェネレーション(世代を示すことは進行中である)
- ロード紡糸が
- ファイルのダウンロード要求によって消えますブラウザ
私のコード:
<h:form>
<pf:panel>
<pf:commandButton value="Export database" id="exportDatabase" ajax="false" onclick="PrimeFaces.monitorDownload(window.alert('start'), window.alert('stop'));">
<pf:fileDownload value="#{bean.exportDatabase()}" />
</pf:commandButton>
</pf:panel>
</h:form>
豆側:
private StreamedContent exportDatabaseFile;
public StreamedContent exportDatabase() {
String exportDatabaseFilename = "nameOfTheFile.xlsx";
Path nameExportDatabasePath = "C:\nameOfTheFile.xlsx";
// Populate exportDatabaseFile
exportDatabaseFile = new DefaultStreamedContent(new FileInputStream(nameExportDatabasePath.toFile()), FacesContext.getCurrentInstance().getExternalContext().getMimeType(exportDatabaseFilename), exportDatabaseFilename);
return exportDatabaseFile;
}
この問題を解決する方法の任意のアイデア?
この問題は解決しましたか? – Franx