O'Reilly logo

PrimeFaces Beginner's Guide by K. Siva Prasad Reddy

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

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:

  1. 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.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required