如何在 Primefaces 中导出 .pdf 后重定向到其他页面?

How to redirect to other page after .pdf exported in Primefaces?

我想存档一个 "Close and Print" 函数,关闭发票后它会立即导出为 .pdf(这是系统中的 "print")并且用户将被重定向到发票清单。

这是我尝试创建的命令按钮:

<p:menuitem oncomplete="javascript:saved=true" 
            action="#{myController.setFinalAndPrint}"  
            disabled="#{myController.selected.status == 2}"
            value="#{bundle.Finalize} &amp; #{bundle.Print}" 
            update=":center,:growl" 
            icon="ui-icon-check"
            ajax="false"
            class=""/>

这是我的控制器中的 setFinalAndPrint 方法:

  public void setFinalAndPrint() {
        setFinal();

        breadCrumb.goToInvoice();

        reportForm();
    }

setFinal 工作正常,reportForm 也工作正常,Chrome 正在获取弹出窗口以保存 .pdf 但页面未重定向...

是否可以导出 .pdf 并以​​某种方式导航到其他页面?

谢谢!

编辑:

尝试过:

oncomplete="location.reload( true );" 

遗憾的是,这也不起作用:(

发现自己:

在按钮上使用 WidgetVar 并像这样使用 jQuery:

<script type="text/javascript">
    jQuery(document).ready(function(){ 
        PF('myWidgetVar').jq.click();
    }) 
</script>