Example usage for org.apache.commons.validator Validator setPage

List of usage examples for org.apache.commons.validator Validator setPage

Introduction

In this page you can find the example usage for org.apache.commons.validator Validator setPage.

Prototype

public void setPage(int page) 

Source Link

Document

Sets the page.

Usage

From source file:org.apache.struts.validator.Resources.java

/**
 * Initialize the <code>Validator</code> to perform validation.
 *
 * @param key         The key that the validation rules are under (the
 *                    form elements name attribute).
 * @param bean        The bean validation is being performed on.
 * @param application servlet context// w  w  w. j  av a 2s .c o  m
 * @param request     The current request object.
 * @param errors      The object any errors will be stored in.
 * @param page        This in conjunction with  the page property of a
 *                    <code>Field<code> can control the processing of
 *                    fields.  If the field's page is less than or equal
 *                    to this page value, it will be processed.
 */
public static Validator initValidator(String key, Object bean, ServletContext application,
        HttpServletRequest request, ActionMessages errors, int page) {
    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;
}

From source file:org.springmodules.validation.commons.AbstractPageBeanValidator.java

protected void initValidator(Validator validator) {
    validator.setPage(page);
}

From source file:org.springmodules.validation.commons.AbstractPageBeanValidator.java

protected void cleanupValidator(Validator validator) {
    validator.setPage(DEFAULT_PAGE);
}