Class ValidatorsTag

  • All Implemented Interfaces:
    ConditionalTag, PropertiesSupport, PropertySupport, org.apache.commons.jelly.DynaTag, org.apache.commons.jelly.impl.BeanSource, org.apache.commons.jelly.Tag

    public class ValidatorsTag
    extends ValidatorBaseTag<ChainValidator>

    A tag handler class for combining multiple validators to be assigned to an input component.

    In some cases a single validator is not sufficient for testing the validity of an input field; multiple validators are needed (e.g. a required validator plus a data type specific validator). With this tag handler class a ChainValidator can be created, which can combine an arbitrary number of child validators.

    This tag can be put in the body of a tag defining an input component. In the tag's body an arbitrary number of nested <validator> tags (as implemented by ValidatorTag) can be placed. Each validator defined by these child tags will be added to the resulting ChainValidator.

    The following table lists the attributes supported by this tag:

    Attribute Description Optional
    shortEvaluation Here a boolean value can be specified controlling the shortEvaluation flag of the resulting ChainValidator. Have a look at ChainValidator for more details. The default value is true. Yes

    Version:
    $Id: ValidatorsTag.java 205 2012-01-29 18:29:57Z oheger $
    Author:
    Oliver Heger
    • Constructor Detail

      • ValidatorsTag

        public ValidatorsTag()
        Creates a new instance of ValidatorsTag.
    • Method Detail

      • addChildValidator

        public void addChildValidator​(Validator child,
                                      Map<String,​Object> props)
        Adds a new child validator. This method is intended to be called by tags in the body that define child validators.
        Parameters:
        child - the validator to add
        props - a map with optional properties for this child validator
      • passResults

        protected boolean passResults​(Object bean)
                               throws org.apache.commons.jelly.JellyTagException
        Passes the resulting bean to its target. This implementation initializes the resulting ChainValidator with the child validators added by child tags.
        Overrides:
        passResults in class TransformerBaseTag<ChainValidator>
        Parameters:
        bean - the (validator) bean to initialize
        Returns:
        a flag whether the bean could be passed to the target
        Throws:
        org.apache.commons.jelly.JellyTagException - if an error occurs