-
- All Superinterfaces:
- EventListener
- All Known Implementing Classes:
- BeanValidator, DoubleRangeValidator, LengthValidator, LongRangeValidator, MethodExpressionValidator, RegexValidator, RequiredValidator
public interface Validator extends EventListener
A Validator implementation is a class that can perform validation (correctness checks) on a
EditableValueHolder
. Zero or moreValidator
s can be associated with eachEditableValueHolder
in the view, and are called during the Process Validations phase of the request processing lifecycle.Individual
Validator
s should examine the value and component that they are passed, and throw aValidatorException
containing aFacesMessage
, documenting any failures to conform to the required rules.For maximum generality,
Validator
instances may be configurable based on properties of theValidator
implementation class. For example, a range checkValidator
might support configuration of the minimum and maximum values to be used.Validator
implementations must have a zero-arguments public constructor. In addition, if theValidator
class wishes to have configuration property values saved and restored with the view, the implementation must also implementStateHolder
.If the class implementing
Validator
has aResourceDependency
annotation, the action described inResourceDependency
must be taken whenEditableValueHolder.addValidator(javax.faces.validator.Validator)
is called. If the class implementingValidator
has aResourceDependencies
annotation, the action described inResourceDependencies
must be taken whenEditableValueHolder.addValidator(javax.faces.validator.Validator)
is called.
-
-
Field Summary
Fields Modifier and Type Field and Description static String
NOT_IN_RANGE_MESSAGE_ID
Deprecated.
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method and Description void
validate(FacesContext context, UIComponent component, Object value)
-
-
-
Field Detail
-
NOT_IN_RANGE_MESSAGE_ID
static final String NOT_IN_RANGE_MESSAGE_ID
Deprecated. UseDoubleRangeValidator.NOT_IN_RANGE_MESSAGE_ID
orLongRangeValidator.NOT_IN_RANGE_MESSAGE_ID
instead.The message identifier of the
FacesMessage
to be created if the maximum or minimum value check fails, and both the maximum and minimum values for this validator have been set. The message format string for this message may optionally include a{0}
placeholder, which will be replaced by the configured minimum value, and a{1}
placeholder, which will be replaced by the configured maximum value.- See Also:
- Constant Field Values
-
-
Method Detail
-
validate
void validate(FacesContext context, UIComponent component, Object value) throws ValidatorException
Perform the correctness checks implemented by this
Validator
against the specifiedUIComponent
. If any violations are found, aValidatorException
will be thrown containing theFacesMessage
describing the failure.For a validator to be fully compliant with Version 2 and later of the specification, it must not fail validation on
null
or empty values unless it is specifically intended to addressnull
or empty values. An application-wide<context-param>
is provided to allow validators designed for JSF 1.2 to work with JSF 2 and later. Thejavax.faces.VALIDATE_EMPTY_FIELDS
<context-param>
must be set tofalse
to enable this backwards compatibility behavior.- Parameters:
context
- FacesContext for the request we are processingcomponent
- UIComponent we are checking for correctnessvalue
- the value to validate- Throws:
ValidatorException
- if validation failsNullPointerException
- ifcontext
orcomponent
isnull
-
-
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/validator/validator.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
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.