0
我想在我的文件下载后强制重新加载页面。如何强制在primefaces中重新加载页面?
我试过,但没有奏效
<p:commandButton ajax="false" actionListener="#{fileDownloadController.forceDownload}">
<p:fileDownload value="#{fileDownloadController.downloadXMLFile(myBean.mostRecentFile)}" />
</p:commandButton>
</p:commandButton>
EDITED 该解决方案正确地重新加载,但它发生之前的文件可以下载
public StreamedContent downloadXMLFile(DMFile dmFile) {
...
return new DefaultStreamedContent(stream, "text/xml", fileName);
}
而且
public void forceReload(){
ExternalContext ec = FacesContext.getCurrentInstance().getExternalContext();
try {
ec.redirect(((HttpServletRequest) ec.getRequest()).getRequestURI());
} catch (IOException ex) {
Logger.getLogger(FileDownloadController.class.getName()).log(Level.SEVERE, null, ex);
}
}
感谢,但我在哪里赶urlStr? – stackSaru
我编辑我的回答,希望它会帮助你 –
是的,谢谢,这正是我不过是求,我不能下载任何更多 – stackSaru