I've never used Validator outside of Struts, but I do know I've successfully referenced nested elements while validating, by using dot notation. In your case, you can refer to fields "a", "b", "obj.i, "obj.j", "obj.obj.k".
Hubert On 8/24/05, Ashutosh Satyam <[EMAIL PROTECTED]> wrote: > 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 > > > > --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]