Interface Validator<T>

    • Field Detail

      • NOT_IN_RANGE_MESSAGE_ID

        static final java.lang.String NOT_IN_RANGE_MESSAGE_ID

        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,
                      T value)
               throws ValidatorException

        Perform the correctness checks implemented by this Validator against the specified UIComponent. If any violations are found, a ValidatorException will be thrown containing the FacesMessage 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 address null 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. The javax.faces.VALIDATE_EMPTY_FIELDS <context-param> must be set to false to enable this backwards compatibility behavior.

        Parameters:
        context - FacesContext for the request we are processing
        component - UIComponent we are checking for correctness
        value - the value to validate
        Throws:
        ValidatorException - if validation fails
        java.lang.NullPointerException - if context or component is null