Package org.apache.commons.validator

Examples of org.apache.commons.validator.Validator


        ActionErrors errors = new ActionErrors();



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

                                                            this,

                                                            application, request,

                                                            errors, page);



    try {

       validatorResults = 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 {
       validatorResults = 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 {

       validatorResults = validator.validate();

        } catch (ValidatorException e) {

       log.error(e.getMessage(), e);
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.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

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

        String validationKey = getValidationKey(mapping, request);

        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

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

        String validationKey = getValidationKey(mapping, request);

        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

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

        Locale locale = RequestUtils.getUserLocale(request, null);

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

        validator.setPage(page);

        validator.setParameter(SERVLET_CONTEXT_PARAM, application);
        validator.setParameter(HTTP_SERVLET_REQUEST_PARAM, request);
        validator.setParameter(Validator.LOCALE_PARAM, locale);
        validator.setParameter(ACTION_MESSAGES_PARAM, errors);
        validator.setParameter(Validator.BEAN_PARAM, bean);

        return validator;
    }
View Full Code Here

            try
            {
                //
                // 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 );
                validatorResults.merge( actionV.validate() );
            }
            catch ( ValidatorException e )
            {
                _log.error( e.getMessage(), e );
            }
View Full Code Here

        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

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

        Locale locale = RequestUtils.getUserLocale(request, null);

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

        validator.setPage(page);

        validator.setParameter(SERVLET_CONTEXT_PARAM, application);
        validator.setParameter(HTTP_SERVLET_REQUEST_PARAM, request);
        validator.setParameter(Validator.LOCALE_PARAM, locale);
        validator.setParameter(ACTION_MESSAGES_PARAM, errors);
        validator.setParameter(Validator.BEAN_PARAM, bean);

        return validator;
    }
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.