Displaying notifications using the growl component

The PrimeFaces Growl component is similar to MAC OS's growl notification widget, which can be used to display FacesMessage. The Growl component is similar to the Messages component, and thus have similar attributes to customize its behavior.

We can use the following attributes to customize the Growl components behavior:

  • autoUpdate: When enabled, growl is updated for each AJAX request implicitly.
  • severity: It is a comma-separated list of severity levels for display purposes only.
  • globalOnly: When true, only the FacesMessage without client IDs are displayed. Default is false.
  • sticky: It specifies whether the message should stay instead of being hidden automatically. Default is false.
  • life: It is the duration in milliseconds to display non-sticky messages. Default is 6000 ms.
  • for: Identifier of the component whose messages to display only, takes precedence when used with globalOnly.
  • escape: It defines whether HTML would be escaped or not, defaults to true.

Let us see how to use the <p:growl> component to display the FacesMessage objects as follows:

Displaying notifications using the growl component