PrimeFaces Beginner's Guide
上QQ阅读APP看书,第一时间看更新

Introducing the Message component

Message is an enhanced version of the standard JSF Message component with additional features and skinning capabilities. The <p:message> component is similar to the standard JSF's <h:message>, and is used to output a single message for a specific component as follows:

<p:message for="email"/>

The <p:message/> component provides the following attributes, which can be used to customize message display:

  • showSummary: This specifies whether the summary of FacesMessages should be displayed. Default value is false
  • showDetail: This specifies whether the detail of FacesMessages should be displayed. Default value is true
  • for: ID of the component whose message is to be displayed
  • display: Display mode can be text, icon, or both. Default is both.
    • text: Only message text is displayed
    • icon: Only message severity is displayed and message text is visible as a tooltip
    • both: Both icon and text are displayed
  • escape: This defines whether HTML would be escaped or not. Default value is true.
  • severity: This only displays a comma-separated list of severities.