javax.faces.application
Class FacesMessage

java.lang.Object
  extended by javax.faces.application.FacesMessage
All Implemented Interfaces:
java.io.Serializable

public class FacesMessage
extends java.lang.Object
implements java.io.Serializable

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.

The implementation must take the following steps when creating FacesMessage instances given a messageId:

See Also:
Serialized Form

Nested Class Summary
static class FacesMessage.Severity
          Class used to represent message severity levels in a typesafe enumeration.
 
Field Summary
static java.lang.String FACES_MESSAGES
          ResourceBundle identifier for messages whose message identifiers are defined in the JavaServer Faces specification.
static FacesMessage.Severity SEVERITY_ERROR
          Message severity level indicating that an error has occurred.
static FacesMessage.Severity SEVERITY_FATAL
          Message severity level indicating that a serious error has occurred.
static FacesMessage.Severity SEVERITY_INFO
          Message severity level indicating an informational message rather than an error.
static FacesMessage.Severity SEVERITY_WARN
          Message severity level indicating that an error might have occurred.
static java.util.List VALUES
          Immutable List of valid FacesMessage.Severity instances, in ascending order of their ordinal value.
static java.util.Map VALUES_MAP
          Immutable Map of valid FacesMessage.Severity instances, keyed by name.
 
Constructor Summary
FacesMessage()
          Construct a new FacesMessage with no initial values.
FacesMessage(FacesMessage.Severity severity, java.lang.String summary, java.lang.String detail)
          Construct a new FacesMessage with the specified initial values.
FacesMessage(java.lang.String summary)
          Construct a new FacesMessage with just a summary.
FacesMessage(java.lang.String summary, java.lang.String detail)
          Construct a new FacesMessage with the specified initial values.
 
Method Summary
 java.lang.String getDetail()
          Return the localized detail text.
 FacesMessage.Severity getSeverity()
          Return the severity level.
 java.lang.String getSummary()
          Return the localized summary text.
 boolean isRendered()
           
 void rendered()
          Marks this message as having been rendered to the client.
 void setDetail(java.lang.String detail)
          Set the localized detail text.
 void setSeverity(FacesMessage.Severity severity)
          Set the severity level.
 void setSummary(java.lang.String summary)
          Set the localized summary text.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

FACES_MESSAGES

public static final java.lang.String FACES_MESSAGES

ResourceBundle identifier for messages whose message identifiers are defined in the JavaServer Faces specification.

See Also:
Constant Field Values

SEVERITY_INFO

public static final FacesMessage.Severity SEVERITY_INFO

Message severity level indicating an informational message rather than an error.


SEVERITY_WARN

public static final FacesMessage.Severity SEVERITY_WARN

Message severity level indicating that an error might have occurred.


SEVERITY_ERROR

public static final FacesMessage.Severity SEVERITY_ERROR

Message severity level indicating that an error has occurred.


SEVERITY_FATAL

public static final FacesMessage.Severity SEVERITY_FATAL

Message severity level indicating that a serious error has occurred.


VALUES

public static final java.util.List VALUES

Immutable List of valid FacesMessage.Severity instances, in ascending order of their ordinal value.


VALUES_MAP

public static final java.util.Map VALUES_MAP

Immutable Map of valid FacesMessage.Severity instances, keyed by name.

Constructor Detail

FacesMessage

public FacesMessage()

Construct a new FacesMessage with no initial values. The severity is set to Severity.INFO.


FacesMessage

public FacesMessage(java.lang.String summary)

Construct a new FacesMessage with just a summary. The detail is null, the severity is set to Severity.INFO.


FacesMessage

public FacesMessage(java.lang.String summary,
                    java.lang.String detail)

Construct a new FacesMessage with the specified initial values. The severity is set to Severity.INFO.

Parameters:
summary - Localized summary message text
detail - Localized detail message text
Throws:
IllegalArgumentException - if the specified severity level is not one of the supported values

FacesMessage

public FacesMessage(FacesMessage.Severity severity,
                    java.lang.String summary,
                    java.lang.String detail)

Construct a new FacesMessage with the specified initial values.

Parameters:
severity - the severity
summary - Localized summary message text
detail - Localized detail message text
Throws:
IllegalArgumentException - if the specified severity level is not one of the supported values
Method Detail

getDetail

public java.lang.String getDetail()

Return the localized detail text. If no localized detail text has been defined for this message, return the localized summary text instead.


setDetail

public void setDetail(java.lang.String detail)

Set the localized detail text.

Parameters:
detail - The new localized detail text

getSeverity

public FacesMessage.Severity getSeverity()

Return the severity level.


setSeverity

public void setSeverity(FacesMessage.Severity severity)

Set the severity level.

Parameters:
severity - The new severity level
Throws:
IllegalArgumentException - if the specified severity level is not one of the supported values

getSummary

public java.lang.String getSummary()

Return the localized summary text.


setSummary

public void setSummary(java.lang.String summary)

Set the localized summary text.

Parameters:
summary - The new localized summary text

isRendered

public boolean isRendered()
Returns:
true if rendered() has been called, otherwise false
Since:
2.0

rendered

public void rendered()

Marks this message as having been rendered to the client.

Since:
2.0


Submit a bug or feature

Copyright © 2009-2011, Oracle Corporation and/or its affiliates. All Rights Reserved. Use is subject to license terms.

Generated on 10-February-2011 12:41