p:menuitem中的target =“_ blank”无法打开新选项卡

时间:2015-11-11 17:16:48

标签: jsf jsf-2 primefaces menuitem new-window

我正在使用primefaces 5.1,liferay 6.2.0-ga2和JSF2。我有一个带按钮的页面。当我按下右键单击上下文菜单时,会显示一个menuitem。该menuitem必须打开一个新选项卡,但它不会。

                        <p:commandButton id="viewUnassignedCase"
                            action="application-container" styleClass="icon fa fa-eye">
                            <f:setPropertyActionListener
                                target="#{applicationManagementBean.application}"
                                value="#{unassignedCase}" />

                            <f:setPropertyActionListener
                                target="#{applicationManagementBean.activeIndexTab}" value="0" />
                        </p:commandButton>

                        <p:contextMenu for="viewUnassignedCase" id="tableMenu" 
                            widgetVar="tableMenu">
                            <p:menuitem value="#{caseList['caseManagement.case.newtab']}" 
                                target="_blank"
                                action="#{applicationManagementBean.openNewTabDetail(unassignedCase)}">
                            </p:menuitem>
                        </p:contextMenu>

和豆

    public String openNewTabDetail(final FlexibleDomain application)
{
    setApplication(application);
    return "application-container";
}

我该如何解决?

1 个答案:

答案 0 :(得分:4)

有一个问题标记为&#34;赢得&#tffix&#34;在Primefaces's GoogleCode上出现此行为(p:menuItem未使用操作打开新窗口)。

在您的情况下,您需要根据基于网址的网址调整基于操作的导航。

我无法弄清楚如何让它在您的项目中发挥作用,但我最好的选择是尝试这样的事情:

<p:contextMenu for="viewUnassignedCase" id="tableMenu" 
                            widgetVar="tableMenu">
                            <p:menuitem value="#{caseList['caseManagement.case.newtab']}" 
                                target="_blank"
                                url="www.yoururl.com/yourdesiredpath">
                            </p:menuitem>
                        </p:contextMenu>

在最糟糕的情况下,您应该尝试覆盖Primefaces的p:menuitem默认行为,或者尝试使用支持此类实现的其他组件。

祝你好运!

相关问题