Time for action – displaying FacesMessages with growl
We will see how to display FacesMessages
with different severity levels as Growl notifications using <p:growl>
. Perform the following steps:
Create a JSF page with a form and growl component:
<p:growl id="growl1" autoUpdate="true" severity="info,warn,error, fatal" sticky="true" globalOnly="true"/> <h:form> <p:commandButton actionListener="#{messagesController.addMultipleMsgs}" value="Add Multiple Messages"/> </h:form>
What just happened?
When the button is clicked, we have added FacesMessages
. The growl component gets updated automatically and displayed notifications because we have set autoUpdate
mode to true
.