jsf 2 - display growl when page is loaded primefaces jsf2 -
i have commandbutton :
<p:commandbutton value="enregistrer" action="#{reglementclientmb.ajouter}" process="@this @form" update="@form" > <f:setpropertyactionlistener target="#{reglementclientmb.est_ajouter}" value="false" /> </p:commandbutton>
the action method return page , want display 1 p:growl
when next page loaded
i tested put constructor of managed bean growl displayed below data in page
facescontext.getcurrentinstance().addmessage( null, new facesmessage(facesmessage.severity_info, "" + "confirmation", "réglement crée avec sucée")); requestcontext.getcurrentinstance().update("messages");
how can achieve this
thank in advance
the bean's constructor may late job if <p:growl>
rendered before bean been constructed first time. e.g.
<p:growl /> ... <h:outputtext value="#{bean.something}" />
it work if bean constructed before <p:growl>
rendered.
<h:outputtext value="#{bean.something}" /> ... <p:growl />
in order solve concrete problem, you'd need job in pre render view listener instead.
<f:event type="prerenderview" listener="#{bean.init}" />
with:
public void init() { // add desired message here. }
Comments
Post a Comment