I have one registration page which uses custom valiadtor
public class CustomValidator implements Validator {
private Validator validator;
public Custom
It appears you only want to validate 2 classes because you want to duplicate the 'confirm password' validation where you have 2 password fields that should match. Instead, why not simply pass an interface to the validator?
public void validate(IPasswordContainer target, Errors errors) {
if(!target.getConfirm_password().equals(target.getPassword())) {
errors.rejectValue("confirm_password", "confirm_password.confirm");
}
}
public boolean supports(Class clazz) {
return IPasswordContainer.class.equals(clazz);
}