Announcement Announcement Module
Collapse
No announcement yet.
Spring - Commons Validator: found the missing link. Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • Spring - Commons Validator: found the missing link.

    In trying to get the Spring/Commons-Validator integration working :x I discovered a misconception that setting up the validator-rules.xml with commons validators would automagically bind errors. They didn't. But a FieldChecks class in org.springframework.validation.commons package does (it's in the sandbox). The following validation-rules.xml entry show how to access it.
    Code:
    <form-validation>
      <global>
    
          <validator name="emailFormat"
                classname="org.springframework.validation.commons.FieldChecks"
                   method="validateEmail"
             methodParams="java.lang.Object,
                           org.apache.commons.validator.ValidatorAction,
                           org.apache.commons.validator.Field,
                           org.springframework.validation.Errors"
                      msg="errors.invalid"/>
      </global>
    </form-validation>
    Thanks for the good work, Daniel. Hopefully, it will make it out in 1.2 final (Hint, Hint).
Working...
X