Package org.apache.commons.validator

Examples of org.apache.commons.validator.Validator


        if ( _legacyInitValidatorMethod != null )
        {
            try
            {
                Object[] args = new Object[]{ beanName, bean, context, request, errors, new Integer( page ) };
                Validator validator = ( Validator ) _legacyInitValidatorMethod.invoke( Resources.class, args );
               
                //
                // The NetUI validator rules work on both 1.1 and 1.2.  They take ActionMessages instead of ActionErrors.
                //
                validator.addResource( "org.apache.struts.action.ActionMessages", errors );
                return validator;
            }
            catch ( IllegalAccessException e )
            {
                assert false : e.getMessage();
View Full Code Here


        if (validatorFormName == null)
        {
            return result; // no validation for this bean
        }

        Validator validator = new Validator(validations, validatorFormName);

        // Tell the validator which bean to validate against.
        validator.setParameter(Validator.BEAN_PARAM, bean);
       
        // Parameters used by our validators
        validator.setParameter("java.util.Map", result);
        validator.setParameter("java.util.ResourceBundle", bundle);
       
        ValidatorResults results = null;
               
        try
        {
            validator.setOnlyReturnErrors(true);
            results = validator.validate();
            if (results.isEmpty())
            {
                return result;
            }
        }
View Full Code Here

                                 HttpServletRequest request) {

        ServletContext application = getServlet().getServletContext();
        ActionErrors errors = new ActionErrors();

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

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

        return errors;
View Full Code Here

                                 HttpServletRequest request) {

        ServletContext application = getServlet().getServletContext();
        ActionErrors errors = new ActionErrors();

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

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

        return errors;
View Full Code Here

                                 HttpServletRequest request) {

       ServletContext application = getServlet().getServletContext();
        ActionErrors errors = new ActionErrors();

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

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

       return errors;
View Full Code Here

                                         ActionErrors errors, int page) {

      ValidatorResources resources = Resources.getValidatorResources(application,request);
      Locale locale = Resources.getLocale(request);

      Validator validator = new Validator(resources, key);
      validator.setUseContextClassLoader(true);

      validator.setPage(page);

      validator.addResource(SERVLET_CONTEXT_KEY, application);
      validator.addResource(HTTP_SERVLET_REQUEST_KEY, request);
      validator.addResource(Validator.LOCALE_KEY, locale);
      validator.addResource(ACTION_ERRORS_KEY, errors);
      validator.addResource(Validator.BEAN_KEY, bean);

      return validator;
   }
View Full Code Here

                                         ActionErrors errors, int page) {

  ValidatorResources resources = StrutsValidatorUtil.getValidatorResources(application);
  Locale locale = StrutsValidatorUtil.getLocale(request);
 
  Validator validator = new Validator(resources, key);

  validator.setPage(page);

   validator.addResource(SERVLET_CONTEXT_KEY, application);
  validator.addResource(HTTP_SERVLET_REQUEST_KEY, request);
  validator.addResource(Validator.LOCALE_KEY, locale);
  validator.addResource(ACTION_ERRORS_KEY, errors);
  validator.addResource(Validator.BEAN_KEY, bean);
      
       return validator;     
   }
View Full Code Here

                                 HttpServletRequest request) {

        ServletContext application = getServlet().getServletContext();
        ActionErrors errors = new ActionErrors()
 
  Validator validator = StrutsValidatorUtil.initValidator(mapping.getPath(),
                                                          this,
                                                          application, request,
                                                          errors, page);
 
  try {
     validator.validate();
        } catch (ValidatorException e) {
     log.error(e.getMessage(), e);
  }

        return errors;
View Full Code Here

        ActionErrors errors = new ActionErrors()

       

  Validator validator = StrutsValidatorUtil.initValidator(mapping.getAttribute(),

                                                          this,

                                                          application, request,

                                                          errors, page);

 

  try {

     validator.validate();

        } catch (ValidatorException e) {

     log.error(e.getMessage(), e);
View Full Code Here

                                 HttpServletRequest request) {

        ServletContext application = getServlet().getServletContext();
        ActionErrors errors = new ActionErrors();

  Validator validator = StrutsValidatorUtil.initValidator(mapping.getPath(),
                                                          this,
                                                          application, request,
                                                          errors, page);

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

        return errors;
View Full Code Here

TOP

Related Classes of org.apache.commons.validator.Validator

Copyright © 2018 www.massapicom. 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.