I'm not sure I understand... You want to use the validation framework
validators from your own code? I haven't tried that... I guess it could
work. You'll need to look at the ValidationContext interface and how it
is used. The ValidationFramework uses this to enable it to add the
messages in the correct spot for sub-properties when using the
VisitorFieldValidator. 

Calling validate() on objects does not execute the validations defined
in the XML files... That is done through the ValidationInterceptor,
which can be applied to the Action in the xwork.xml. Check out the
VisitorFieldValidator if you want to automatically have the sub-objects
have validations as defined in the *-validation.xml files applied. 

Jason

> -----Original Message-----
> From: Bryan White [mailto:[EMAIL PROTECTED] 
> Sent: Friday, October 03, 2003 9:15 PM
> To: WebWork
> Subject: [OS-webwork] Best way to do this?
> 
> 
> Hello all,
> 
> (my apologies if this is a dupe, I sent it previously about 
> an hour ago but never saw it on the list)
> 
> Validation framework question for you all:
> 
> In the execute() method of an Action, I am iterating through 
> a list of objects. On each object, I call a method validate() 
> that will do validation on that object's properties (using 
> xwork). In the event of validation failure, the message needs 
> to be displayed in the resulting JSP/vm template.
> 
> What's the best way to actually implement this?
> 
> In each objects's validate() method, can I use 
> com.opensymphony.xwork.validator.validators.RequiredFieldValidator,
> com.opensymphony.xwork.validator.validators.IntRangeFieldValid
> ator, etc directly? In <object_name>-validation.xml, I add 
> <field> and <field-validator> tags, but when I call 
> validate() on the xwork classes, I get some exceptions 
> leading me to wonder if I am approaching this correctly.
> (com.opensymphony.xwork.validator.ValidationException: Caught 
> exception while getting value for field, 
> ognl.NoSuchPropertyException).
> 
> Thanks in advance!
> 
> Bryan White
> [EMAIL PROTECTED]
> 
> 
> 
> 
> -------------------------------------------------------
> This sf.net email is sponsored by:ThinkGeek
> Welcome to geek heaven.
> http://thinkgeek.com/sf 
> _______________________________________________
> Opensymphony-webwork mailing list 
> [EMAIL PROTECTED]
> https://lists.sourceforge.net/lists/listinfo/opensymphony-webwork
> 


-------------------------------------------------------
This sf.net email is sponsored by:ThinkGeek
Welcome to geek heaven.
http://thinkgeek.com/sf
_______________________________________________
Opensymphony-webwork mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/opensymphony-webwork

Reply via email to