a4j:commandLink在检查onComplete后打开一个新选项卡

时间:2014-09-16 13:24:29

标签: jsf richfaces

有没有办法使用a4j:commandLink中的“oncomplete”从h:commandLink打开一个像“target”这样的新标签? 类似的东西:

target="#{dashBoardBean.possuiDocumento ? '_blank' : '_self'}"


<a4j:commandLink action="#{dashBoardBean.visualizarDocumento}" 
                 oncomplete="#{dashBoardBean.possuiDocumento}">
</a4j:commandLink>

现在我的代码是这样的:

<h:commandLink action="#{dashBoardBean.visualizarDocumento}"
               target="#{uc.documento ? '_blank' : '_self'}">
                <f:setPropertyActionListener value="#{uc}" target="#{dashBoardBean.contentTarget}" />
                <de:statusContent content="#{uc}"/>
</h:commandLink>

现在我需要在操作后进行检查,然后才打开新选项卡,但是h:commanLink没有oncomplete。

1 个答案:

答案 0 :(得分:1)

你可以这样做:

<a4j:commandLink action="#{dashBoardBean.visualizarDocumento}" update="@this" 
    oncomplete="window.open('yourNewPage.xhtml', '#{dashBoardBean.possuiDocumento ? '_blank' : '_self'}')">
</a4j:commandLink>