Hi,
I think I solved the problem.
I modified the CustomerValidator.java
I hope this is correct and it helps.Code:public class CustomerValidator implements Validator { private AddressValidator addressValidator; public AddressValidator getAddressValidator() { return addressValidator; } public void setAddressValidator(AddressValidator addressValidator) { this.addressValidator = addressValidator; } public boolean supports(Class clazz) { return clazz.equals(Customer.class); } public void validate(Object obj, Errors errors) { Customer customer = (Customer) obj; ValidationUtils.rejectIfEmptyOrWhitespace(errors, "name", "required.name", "Name muss gesetzt sein"); int i=0; for (Address address : customer.getAddresses()) { errors.pushNestedPath("addresses["+i+"]"); ValidationUtils.invokeValidator(this.addressValidator, address, errors); errors.popNestedPath(); i++; } } }
Last edited by rognox; Aug 12th, 2009 at 09:59 AM.
http://forum.springsource.org/showthread.php?76132-Nested-validation-of-an-List
No comments:
Post a Comment