javax.faces.application

Class FacesMessage

  • All Implemented Interfaces:
    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.

    See Also:
    Serialized Form
    • Field Detail

      • FACES_MESSAGES

        public static final 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 List VALUES

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

    • Constructor Detail

      • 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.

        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,
                            String summary,
                            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 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.

        Parameters:
        detail - The new localized detail text
      • 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 String getSummary()

        Return the localized summary text.

      • setSummary

        public void setSummary(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

Deutsche Übersetzung

Sie haben gebeten, diese Seite auf Deutsch zu besuchen. Momentan ist nur die Oberfläche übersetzt, aber noch nicht der gesamte Inhalt.

Wenn Sie mir bei Übersetzungen helfen wollen, ist Ihr Beitrag willkommen. Alles, was Sie tun müssen, ist, sich auf der Website zu registrieren und mir eine Nachricht zu schicken, in der Sie gebeten werden, Sie der Gruppe der Übersetzer hinzuzufügen, die Ihnen die Möglichkeit gibt, die gewünschten Seiten zu übersetzen. Ein Link am Ende jeder übersetzten Seite zeigt an, dass Sie der Übersetzer sind und einen Link zu Ihrem Profil haben.

Vielen Dank im Voraus.

Dokument erstellt 11/06/2005, zuletzt geändert 18/08/2025
Quelle des gedruckten Dokuments:https://www.gaudry.be/de/java-api-javaee-rf-javax/faces/application/FacesMessage.html

Die Infobro ist eine persönliche Seite, deren Inhalt in meiner alleinigen Verantwortung liegt. Der Text ist unter der CreativeCommons-Lizenz (BY-NC-SA) verfügbar. Weitere Informationen auf die Nutzungsbedingungen und dem Autor.

Referenzen

  1. Zeigen Sie - html-Dokument Sprache des Dokuments:fr Manuel PHP : https://docs.oracle.com, FacesMessage (Java(TM) EE 7 Specification APIs)

Diese Verweise und Links verweisen auf Dokumente, die während des Schreibens dieser Seite konsultiert wurden, oder die zusätzliche Informationen liefern können, aber die Autoren dieser Quellen können nicht für den Inhalt dieser Seite verantwortlich gemacht werden.
Der Autor dieser Website ist allein dafür verantwortlich, wie die verschiedenen Konzepte und Freiheiten, die mit den Nachschlagewerken gemacht werden, hier dargestellt werden. Denken Sie daran, dass Sie mehrere Quellinformationen austauschen müssen, um das Risiko von Fehlern zu reduzieren.