【发布时间】:2020-07-22 03:29:52
【问题描述】:
首先,这个问题只在 Edge 上,在 Chrome 和 Firefox 上一切正常。
我正在使用 JSF 1.2 和 RichFaces 3.3.3.Final(针对 IE9+ 进行社区修复)。
我有一个rich:modalPanel,它由a4j:commandButton 打开。在模态面板上有一个h:commandButton,它隐藏了模态面板并导出使用 jasperReports 生成的 pdf。我的问题是第一次导出文件后,模式面板不再显示。我必须重新加载页面,然后它才能再次工作。当我按a4j:commandButton 打开模式面板时,控制台中没有任何新内容,最后一条日志是“HTML1300:发生导航”。来自按下h:commandButton。
打开模式面板 (contents.jspx) - 将 printBean.showModalPanel 设置为 true:
<a4j:commandButton
image="/img/print.gif"
styleClass="clsCursorPointer"
action="#{ printBean.onExportReport}"
ajaxSingle="true"
reRender="printConfirmationPanel" />
模态面板(forms.jspx):
<h:panelGroup id="printConfirmationPanel" >
<rich:modalPanel id="printConfirmationMP"
autosized="true"
showWhenRendered="true"
rendered="#{ printBean.showModalPanel}" >
<h:form>
<h:panelGrid columns="2" style="margin: auto">
<h:commandButton id="confirmButton" <--- Export button
value="#{ msgs['printButton']}"
actionListener="#{ printBean.onExportButton}" >
<f:attribute name="format" value="PDF"/>
(more attributes)
</h:commandButton>
<rich:componentControl
attachTo="confirmButton"
for="printConfirmationMP"
operation="hide"
event="onclick" />
</h:panelGrid>
</h:form>
</rich:modalPanel>
</h:panelGroup>
【问题讨论】:
-
能否把
printBean.onExportButton方法的代码贴出来。 -
我也发现了这个question。另外由于我不太了解richfaces库,请尝试不通过ajax下载文件