Note that each bean has a corresponding custom validation class begins with V.
String oldPath = errors.getNestedPath(); errors.setNestedPath(oldPath + "bbb"); // is this correct?
// run the validation ...
// reset the old path errors.setNestedPath(oldPath);
Then whenever the validation is invoked, there is an error message shown on the console. I think this is because Spring Framework cannot correctly pass the "bbb.ccc" because bbb is a Collection type defined in A.class.
Also note that if the bbb is not a collecton type, everything works fine.
the error message is shown below. Mon Aug 27 14:18:17 BST 2007 - Ignoring item test_case, notReadablePropertyException: An unrecoverable error has occurred: Invalid property 'bbb.ccc' of bean class [A]: Bean property 'bbb.ccc' is not readable or has an invalid getter method: Does the return type of the getter match the parameter type of the setter? (ccc).
I think this issue also reveals a bigger question on using the setNestedPath(String) method, when the subtree contains a collection type object, does a simple String like "bbb" be able to let Framework find the correct property for the Error message?
I have a solution myself now. It follows standard Java bean notation. aaa.bbb.ccc means aaa.getBbb().getCcc(). For collections the notation changes to aaa.bbb[index].ccc and is translated to aaa.getBbb().get(index).getCcc().
After those amazing square brackets, my code works perfectly.