Example usage for org.springframework.validation Errors getFieldErrorCount

List of usage examples for org.springframework.validation Errors getFieldErrorCount

Introduction

In this page you can find the example usage for org.springframework.validation Errors getFieldErrorCount.

Prototype

int getFieldErrorCount();

Source Link

Document

Return the number of errors associated with a field.

Usage

From source file:org.jasig.portlet.cms.controller.PostValidator.java

@SuppressWarnings("unchecked")
private void validatePostContent(final Post post, final Errors errors) {
    System.out.println(errors.getFieldErrorCount());

    if (errors.getFieldValue("content") != null) {
        final List<String> errorList = (List<String>) getXssValidatorService().scan(post.getContent());

        if (errorList != null && errorList.size() > 0)
            for (final String err : errorList)
                errors.rejectValue("content", "invalid.post.content.xss", new String[] { err }, null);
    }//from   w  ww. ja v  a 2 s . c om
}