Package org.apache.commons.validator

Examples of org.apache.commons.validator.Validator.validate()


    validator.setParameter(Validator.BEAN_PARAM, testBean);
    validator.setParameter(Globals.ERRORS_KEY, errors);

    // Get results of the validation.
    try {
      validator.validate();
    } catch (final ValidatorException e) {
      fail();
    }
    return errors;
  }
View Full Code Here


      // add the name bean to the validator as a resource
      // for the validations to be performed on.
      validator.setParameter(Validator.BEAN_PARAM, o);
      validator.setParameter(Globals.ERRORS_KEY, errors);

      validator.validate();
    } catch (ValidatorException e) {
      LOGGER.info("Error validating HttpEvent " + beanName + " : " + e); //$NON-NLS-1$ //$NON-NLS-2$
    } catch (IllegalArgumentException e) {
      LOGGER.warn("Error validating: " + e.getMessage()); //$NON-NLS-1$
    }
View Full Code Here

        ValidatorResults results = null;
               
        try
        {
            validator.setOnlyReturnErrors(true);
            results = validator.validate();
            if (results.isEmpty())
            {
                return result;
            }
        }
View Full Code Here

        ValidatorResults results = null;
               
        try
        {
            validator.setOnlyReturnErrors(true);
            results = validator.validate();
            if (results.isEmpty())
            {
                return result;
            }
        }
View Full Code Here

        Validator validator =
            Resources.initValidator(validationKey, this, application, request,
                errors, page);

        try {
            validatorResults = validator.validate();
        } catch (ValidatorException e) {
            log.error(e.getMessage(), e);
        }

        return errors;
View Full Code Here

        Validator validator =
            Resources.initValidator(validationKey, this, application, request,
                errors, page);

        try {
            validatorResults = validator.validate();
        } catch (ValidatorException e) {
            log.error(e.getMessage(), e);
        }

        return errors;
View Full Code Here

            // Run the validation actions against the bean.  Since all of the properties
            // are null, we expect them all to error out except for street2, which has
            // no validations (it's an optional property)

            results = validator.validate();
            printResults(bean, results, resources);

            // Now set all the required properties, but make the age a non-integer.
            // You'll notice that age will pass the required test, but fail the int
            // test.
View Full Code Here

            bean.setStreet1("1 Test Street");
            bean.setCity("Testville");
            bean.setState("TE");
            bean.setPostalCode("12345");
            bean.setAge("Too Old");
            results = validator.validate();
            printResults(bean, results, resources);

            // Now everything should pass.
            bean.setAge("123");
            results = validator.validate();
View Full Code Here

            results = validator.validate();
            printResults(bean, results, resources);

            // Now everything should pass.
            bean.setAge("123");
            results = validator.validate();
            printResults(bean, results, resources);

        } finally {
            // Make sure we close the input stream if it was left open.
            if (in != null) {
View Full Code Here

            {
                //
                // Run validations associated with the bean.
                //
                Validator beanV = initValidator( beanName, bean, servletContext, request, errors, page );
                validatorResults = beanV.validate();
               
                //
                // Run validations associated with the action.
                //
                Validator actionV = initValidator( mapping.getPath(), bean, servletContext, request, errors, page );
View Full Code Here

TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.