1

我想在单击 primefaces 命令按钮时显示一个对话框。在对话框之前,我需要检查一个条件。

我正在使用 Spring web-flow 2.3.0。

所以我这样做,

对话框是

我无法根据这种情况显示此对话框。

请帮助我,任何指针?

SWF 2.3.0 Primefaces 2.2.1 JSF 2 Spring Security 3 Spring 3.1.0M1I EhCache Apache Tomcat 6.0 STS 2.5.1

所以我按照以下更改了我的代码

                    <p:commandLink id="addRequest" immediate="true" value="addreq"
                    oncomplete="dlg3.show()" update="dialogPanel">
                    <f:setPropertyActionListener
                        value="#{searchHandler.selectedAccIns}"
                        target="#{reqSearchHandler.checkAccStatus}" />
                </p:commandLink>

对话框是

                <p:outputPanel id="dialogPanel"
                rendered="#{not reqSearchHandler.accStatusFlag}">
                <p:dialog header="Effect Dialog" widgetVar="dlg3"
                    showEffect="bounce" hideEffect="explode" height="200">
                    <h:outputText
                        value="Account is #{searchHandler.selectedAccIns.accStatusDesc}" />
                    <h:outputText value="Do you want to continue?" />
                    <div align="left">
                        <p:commandButton value="Yes" action="accept" />
                        <p:spacer width="960" height="5" />
                        <p:commandButton value="No" action="cancel" />
                    </div>
                </p:dialog>
            </p:outputPanel>

但是当我点击命令链接时,我得到了 3 个对话框。你能告诉我为什么会这样吗?

4

1 回答 1

1

其他人刚刚发布了同样的问题!:)

您应该使用oncomplete属性而不是onclick命令按钮。click javascript 事件在页面回发之前发生,可能导致您的对话框由于页面重新加载而未出现。

oncomplete="dlg3.show()"将在回发后显示对话框。

于 2011-09-02T11:37:57.860 回答