FacesMessage (Java EE 5 SDK)

Java

Java EE 5 SDK

深圳电信培训中心.徐海蛟老师.


javax.faces.application Class FacesMessage

java.lang.Object
  extended by javax.faces.application.FacesMessage
所有已实现的接口:
Serializable

public class FacesMessage
extends Object
implements 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:

    Call Application.getMessageBundle(). If non-null, locate the named ResourceBundle, using the Locale from the current UIViewRoot and see if it has a value for the argument messageId. If it does, treat the value as the summary of the FacesMessage. If it does not, or if Application.getMessageBundle() returned null, look in the ResourceBundle named by the value of the constant FACES_MESSAGES and see if it has a value for the argument messageId. If it does, treat the value as the summary of the FacesMessage. If it does not, there is no initialization information for the FacesMessage 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 the detail for the returned FacesMessage.

    Make sure to perform any parameter substitution required for the summary and detail of the FacesMessage.

另请参见:
Serialized Form

嵌套类摘要
static class FacesMessage.Severity
          Class used to represent message severity levels in a typesafe enumeration.
 
字段摘要
static 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 List VALUES
          Immutable List of valid FacesMessage.Severity instances, in ascending order of their ordinal value.
static Map VALUES_MAP
          Immutable Map of valid FacesMessage.Severity instances, keyed by name.
 
构造器摘要
FacesMessage()
          Construct a new FacesMessage with no initial values.
FacesMessage(FacesMessage.Severity severity, String summary, String detail)
          Construct a new FacesMessage with the specified initial values.
FacesMessage(String summary)
          Construct a new FacesMessage with just a summary.
FacesMessage(String summary, String detail)
          Construct a new FacesMessage with the specified initial values.
 
方法摘要
 String getDetail()
          Return the localized detail text.
 FacesMessage.Severity getSeverity()
          Return the severity level.
 String getSummary()
          Return the localized summary text.
 void setDetail(String detail)
          Set the localized detail text.
 void setSeverity(FacesMessage.Severity severity)
          Set the severity level.
 void setSummary(String summary)
          Set the localized summary text.
 
类方法继承 java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

字段详细信息

FACES_MESSAGES

public static final String FACES_MESSAGES

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

另请参见:
常量字段


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 List VALUES

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


VALUES_MAP

public static final Map VALUES_MAP

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

构造器详细信息

FacesMessage

public FacesMessage()

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


FacesMessage

public FacesMessage(String summary)

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


FacesMessage

public FacesMessage(String summary,
                    String detail)

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

参数:
summary - Localized summary message text
detail - Localized detail message text
抛出异常:
IllegalArgumentException - if the specified severity level is not one of the supported values


FacesMessage

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

Construct a new FacesMessage with the specified initial values.

参数:
severity - the severity
summary - Localized summary message text
detail - Localized detail message text
抛出异常:
IllegalArgumentException - if the specified severity level is not one of the supported values

方法详细信息

getDetail

public 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(String detail)

Set the localized detail text.

参数:
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.

参数:
severity - The new severity level
抛出异常:
IllegalArgumentException - if the specified severity level is not one of the supported values

getSummary

public String getSummary()

Return the localized summary text.


setSummary

public void setSummary(String summary)

Set the localized summary text.

参数:
summary - The new localized summary text

Java EE 5 SDK

深圳电信培训中心.徐海蛟老师.


提交错误或意见

版权所有 2007 Sun Microsystems, Inc. 保留所有权利。 请遵守许可证条款。深圳电信培训中心.徐海蛟老师教学参考.