Hi, I'm reposting this mail with the hope that I can get response from someone.
If anyone of you have any clue on the question mentioned below, kindly get back. Thanks, Ashutosh -----Original Message----- From: Ashutosh Satyam Sent: Thursday, August 25, 2005 11:28 PM To: Struts Users Mailing List Subject: RE: Struts Validator Framework Hi Hubert, Thanks for your response. It worked the way you told by using dot delimiters to point out the nested object. On the same lines, I have one more question. How do I validate an array of objects. This is my class strucutre. - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - Class X{ String a; Y b; } Class Y{ String i; String[] j; } - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - I could reference the nested element 'i' in class Y by using "b.i", but I couldn't validate j; I tried the following with the indexedListProperty construct: <field property="b.j" indexedListProperty="b.j" depends="required"> ---failed <field property="b.j" indexedListProperty="j" depends="required"> ---failed <field property="j" indexedListProperty="b.j" depends="required"> ---failed but each time I got an exception: java.lang.NullPointerException at org.apache.commons.validator.Field.getIndexedProperty(Field.java:780) at org.apache.commons.validator.Field.validate(Field.java:875) at org.apache.commons.validator.Form.validate(Form.java:174) at org.apache.commons.validator.Validator.validate(Validator.java:367) Could you tell me where am I doing wrong. Regards, Ashutosh -----Original Message----- From: Hubert Rabago [mailto:[EMAIL PROTECTED] Sent: Thu 8/25/2005 1:36 AM To: Struts Users Mailing List Cc: Subject: Re: Struts Validator Framework 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]