を使用。私はPrimeFaces.Monitordownload関数を使用して進行状況を監視しています。最初にファイルが作成され、ダウンロードされます。何かがうまくいかない場合、エラーファイルが作成され、リアルファイルの代わりにストリーミングされたコンテンツと共にダウンロードされます。これは問題なく、うまくいきます。この問題は、エラー・メッセージとともにエラー・メッセージを追加したいときに発生します。私はうなずきを更新する方法を知らない。 <p:growl/>文句を言わないショーのメッセージ[OK]をPrimeFaces.MonitorDownload
PrimeFaces.monitorDownloadを使用して
は、私は、Ajax = falseを設定する必要があります。これは私の問題の一部になるでしょうか? commandButton、AUTOUPDATE =を真のうなり声そのものではなく、何に:私は、pに更新=「うなり声」を設定するように、複数のものを試してみました。私は背中の豆で何か間違ったことをしているかもしれないが、そうは思わない。
boolean fileCreated = processor.start();
if(fileCreated){
File xlsfile = new File(filePath);
InputStream stream = new FileInputStream(xlsfile);
file = new DefaultStreamedContent(stream, "file/xlsx", fileName);
return file;
}else{
fileName = fileName.replace(".xlsx", ".txt");
filePath = rootPath + fileName;
File xlsfile = new File(filePath);
InputStream stream = new FileInputStream(xlsfile);
file = new DefaultStreamedContent(stream, "file/txt", fileName);
message = new FacesMessage(FacesMessage.SEVERITY_WARN, "Something went wrong!", "Please send an email to servicedesk and alert the administrators of this page!");
FacesContext.addMessage(null, message);
return file;
}
そして、私のXHTML:
<p:dialog modal="true" widgetVar="statusDialog" header="Status"
footer="Creating file. It might take up to 30 minutes, depending on the file size."
draggable="true" closable="false" resizable="false">
<p:graphicImage name="/bigLoader.gif"
style="margin-left :auto; margin-right:3.7cm;" />
</p:dialog>
<p:commandButton id="submitBtn" value="submit" ajax="false"
disabled="#{controllerBean.selectedBrands.size() lt 1}"
styleClass="btn btn-default"
onclick="PrimeFaces.monitorDownload(start, stop);">
<p:fileDownload value="#{controllerBean.file}" />
</p:commandButton>
<p:commandButton value="Add brand" styleClass="btn btn-default"
action="#{controllerBean.addBrand()}"
update=":first:brands: :first:tableGroup: :first:submitBtn:">
</p:commandButton>
イムmojorra 2.2 primefaces 5.3 感謝すべてのヘルプを使用して
は、ここに私のreleventのJavaコードです! update属性は何もしませんので
申し訳ありませんが、それはやるwould't。空白のエラーファイルではありません。それは例外と私が表示したいメッセージが含まれていますが、何かが間違っているときに作成するチケットにそのテキストファイルを含めるようにユーザーに指示します。私はそれを自分で解決しました。ここでは、他の人がこの状況で自分自身を見つけた場合、どうしたのですか?
SwissArmyKnife