如何使用p:growl仅用于确认而不是验证jsf2 primefaces

atb*_*but 7 validation message growl primefaces jsf-2

我只想在提交p:growl对话框时使用,以确认用户已保存记录并使用p:messagefor进行验证

但问题是p:growl也用于旁边的验证 p:message

<p:dialog id="dialog" modal="true" header="Nouveau Type"
                widgetVar="dlg">

                <h:panelGrid id="panel" columns="3" cellpadding="5">



                    <h:outputLabel for="libelle" value="Libelle :" />
                    <p:inputText value="#{typeMB.newtype.libelle}" id="libelle"
                        required="true" label="libelle" requiredMessage="Veuillez saisir une valeur" 
                        validatorMessage="la valeur doit depasser 2 caracteres" >
                        <f:validateLength minimum="2"  />
                    </p:inputText>
                    <p:message for="libelle" display="text"  />

                    <h:outputLabel for="commission" value="commission :" />
                    <h:inputText value="#{typeMB.newtype.commission}" id="commission"
                        required="true" label="commission" 
                        requiredMessage="Veuillez saisir une valeur" 
                        converterMessage="Veuillez saisir un nombre"
                        validatorMessage="Veuillez saisir entre 0 et 100" >
                        <f:validateDoubleRange minimum="10" maximum="100" />
                        </h:inputText>
                    <p:message for="commission" display="text" />


                    <f:facet name="footer">
                        <p:commandButton id="ajouterBoutton" value="Ajouter"
                            update="panel :form:ourdatatable" actionListener="#{typeMB.ajouter}"
                            oncomplete="handleLoginRequest(xhr, status, args)" />
                        <p:commandButton type="reset" value="vider" update="panel"
                    process="@this" actionListener="#{typeMB.reset}" />
                    </f:facet>

                    <p:growl style="z-index=1000" id="growl" showDetail="true"
                        life="3000" />
                </h:panelGrid>


            </p:dialog>
Run Code Online (Sandbox Code Playgroud)

如何让p:growl仅为记录保存以确认它但不验证,因为growl的值是从托管bean设置的:

msg = new FacesMessage(FacesMessage.SEVERITY_INFO, "Confirmation",
                "Type ajouté avec succés");
Run Code Online (Sandbox Code Playgroud)

我希望我能解释更多我的问题

谢谢

Bal*_*usC 14

如果使用null客户端ID 设置消息,则它将成为"全局消息".现在,如果您将globalOnly="true"属性设置为<p:growl>,则它将显示该类消息.

因此,如此

context.addMessage(null, message);
Run Code Online (Sandbox Code Playgroud)

<p:growl ... globalOnly="true" />
Run Code Online (Sandbox Code Playgroud)

应该为你做.