The Message component
provides a way to display error messages related to a single
component.
The two message components, Message and Message Group, display error messages for component rendering and validation. The Message component displays error messages for a specific component.
showSummary
property set to true
and the showDetail
property set to false
.
for
property to the other component and display messages for that component.
You can write your own input validation methods, which can write text to the Message component by throwing ValidatorException(new FacesMessage (String))
. To send your own validation message to a component, throw one of the following exceptions:
ValidatorException(new FacesMessage(summary))
ValidatorException(new FacesMessage(summary, detail))
ValidatorException(new FacesMessage(severity, summary, detail))
For the severity argument, you can pass FacesMessage.SEVERITY_INFO
, FacesMessage.SEVERITY_WARN
, FacesMessage.SEVERITY_ERROR
, or FacesMessage.SEVERITY_FATAL
.
setRequiredMessage
, setConverterMessage
, and setValidatorMessage
methods to specify custom messages.