Hi,
I am using the Struts Validator(Commons Validator) outside the Struts 
framework, to do validation.
I would like to know how to validate an object when it has objects nested 
within it, and I need to 
validate the fields in those nested objects, too.
 
Precisely I intend to achieve the following. A pseudo code of my requirement.
I am passing object of class X to the validator., as shown below
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Class X{ 
        String a; 
        String b; 
        Y obj; 
} 
Class Y{ 
         String i; 
         String j; 
         Z obj; 
} 
Class Z{ 
        String k; 
} 
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - -

I am trying to validate an object of class X, and I need to validate the 
enclosed object of Class Y, 
and the object of class Z further encapsulated in Y. 
 
Is it doable using the existing Validator framework. Is there a way to specify 
this kind of 
nested validation in the "validation-rules.xml" ( configuration file used by 
validator )
 
If yes can anyone give me a pointer on the same.
 
 
Regards,
Ashutosh

         

Reply via email to