Package jakarta.faces.application
Class FacesMessage
java.lang.Object
jakarta.faces.application.FacesMessage
- All Implemented Interfaces:
Serializable
- Direct Known Subclasses:
ParametrizableFacesMessage
FacesMessage
represents a single validation (or other) message, which is typically associated with a
particular component in the view. A FacesMessage
instance may be created based on a specific messageId. The
specification defines the set of messageIds for which there must be FacesMessage
instances.
- Call
Application.getMessageBundle()
. Ifnon-null
, locate the namedResourceBundle
, using theLocale
from the currentUIViewRoot
and see if it has a value for the argumentmessageId
. If it does, treat the value as thesummary
of theFacesMessage
. If it does not, or ifApplication.getMessageBundle()
returned null, look in the ResourceBundle named by the value of the constantFACES_MESSAGES
and see if it has a value for the argument messageId. If it does, treat the value as the summary of theFacesMessage
. If it does not, there is no initialization information for theFacesMessage
instance. - In all cases, if a
ResourceBundle
hit is found for the{messageId}
, look for further hits under the key{messageId}_detail
. Use this value, if present, as thedetail
for the returnedFacesMessage
. - Make sure to perform any
parameter substitution required for the
summary
anddetail
of theFacesMessage
.
- See Also:
-
Nested Class Summary
Nested Classes -
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final String
ResourceBundle
identifier for messages whose message identifiers are defined in the JavaServer Faces specification.static final FacesMessage.Severity
Message severity level indicating that an error has occurred.static final FacesMessage.Severity
Message severity level indicating that a serious error has occurred.static final FacesMessage.Severity
Message severity level indicating an informational message rather than an error.static final FacesMessage.Severity
Message severity level indicating that an error might have occurred.static final List<FacesMessage.Severity>
ImmutableLis
of validFacesMessage.Severity
instances, in ascending order of their ordinal value.static final Map<String,
FacesMessage.Severity> ImmutableMap
of validFacesMessage.Severity
instances, keyed by name. -
Constructor Summary
ConstructorsConstructorDescriptionConstruct a newFacesMessage
with no initial values.FacesMessage
(FacesMessage.Severity severity, String summary, String detail) Construct a newFacesMessage
with the specified initial values.FacesMessage
(String summary) Construct a newFacesMessage
with just a summary.FacesMessage
(String summary, String detail) Construct a newFacesMessage
with the specified initial values. -
Method Summary
Modifier and TypeMethodDescriptionboolean
Return the localized summary text.int
hashCode()
boolean
void
rendered()
void
Set the localized detail text.void
setSeverity
(FacesMessage.Severity severity) Return the severity level.void
setSummary
(String summary) Set the localized summary text.toString()
-
Field Details
-
FACES_MESSAGES
ResourceBundle
identifier for messages whose message identifiers are defined in the JavaServer Faces specification.- See Also:
-
SEVERITY_INFO
Message severity level indicating an informational message rather than an error. -
SEVERITY_WARN
Message severity level indicating that an error might have occurred. -
SEVERITY_ERROR
Message severity level indicating that an error has occurred. -
SEVERITY_FATAL
Message severity level indicating that a serious error has occurred. -
VALUES
ImmutableLis
of validFacesMessage.Severity
instances, in ascending order of their ordinal value. -
VALUES_MAP
ImmutableMap
of validFacesMessage.Severity
instances, keyed by name.
-
-
Constructor Details
-
FacesMessage
public FacesMessage()Construct a newFacesMessage
with no initial values. The severity is set to Severity.INFO. -
FacesMessage
Construct a newFacesMessage
with just a summary. The detail is null, the severity is set toSeverity.INFO
. -
FacesMessage
Construct a newFacesMessage
with the specified initial values. The severity is set to Severity.INFO.- Parameters:
summary
- - Localized summary message textdetail
- - Localized detail message text
-
FacesMessage
Construct a newFacesMessage
with the specified initial values.- Parameters:
severity
- - the severitysummary
- - Localized summary message textdetail
- - Localized detail message text
-
-
Method Details
-
getSeverity
- Returns:
-
setSeverity
Return the severity level. -
getSummary
Return the localized summary text. -
setSummary
Set the localized summary text.- Parameters:
summary
- - The new localized summary text
-
getDetail
- Returns:
-
setDetail
Set the localized detail text.- Parameters:
detail
- - The new localized detail text
-
isRendered
public boolean isRendered() -
rendered
public void rendered() -
hashCode
public int hashCode() -
equals
-
toString
-