That's a possibility... I've just recently checked in a
VisitorFieldValidator that might work better for this, however. What it
does it to use the Validation framework to validate another object (or
collection / array) using that object's validation files. That way, you
could use the same model in many actions without having to duplicate the
validations in each of the actions. 

http://wiki.opensymphony.com/space/Using+the+VisitorFieldValidator

Do you think this would work better? I just worry about having to define
validations for each action that wants to be ModelDriven from the same
model (or ones that want to just use the model object). I think it's
better to keep the validations for an object all in one place, not
scattered around in different files for each place that uses it.

Jason

> -----Original Message-----
> From: Marco Papini [mailto:[EMAIL PROTECTED] 
> Sent: Thursday, August 07, 2003 1:13 PM
> To: [EMAIL PROTECTED]
> Subject: [OS-webwork] ValidationInterceptor fails on 
> ModelDriven Actions
> 
> 
> I've noticed that when using field validation on a 
> ModelDriven action, 
> the interceptor tries to validate the action fields instead 
> of model fields. I've tracked down the problem to 
> ValidationInterceptor:
> 
>          // populate model bean's fields if action is ModelDriven, 
> otherwise populate action's fields
>       ActionValidatorManager.validate(action, context);
> 
> I think it should be:
> 
>          // populate model bean's fields if action is ModelDriven, 
> otherwise populate action's fields
>          if (action instanceof ModelDriven) {
>              ActionValidatorManager.validate(((ModelDriven) 
> action).getModel(), context);
>          } else {
>              ActionValidatorManager.validate(action, context);
>          }
> 
> or, perhaps, it should lookup the object directly in the 
> ValueStack (the 
> ModelDrivenInterceptor push the model *before* the action).
> 
> Any thoughts ?
> 
> -- 
> Marco Papini
> 
> 
> 
> 
> -------------------------------------------------------
> This SF.Net email sponsored by: Free pre-built ASP.NET sites 
> including Data Reports, E-commerce, Portals, and Forums are 
> available now. Download today and enter to win an XBOX or 
> Visual Studio .NET. 
> http://aspnet.click-url.com/go/psa00100003ave/direct;at.aspnet
_072303_01/01
_______________________________________________
Opensymphony-webwork mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/opensymphony-webwork


-------------------------------------------------------
This SF.Net email sponsored by: Free pre-built ASP.NET sites including
Data Reports, E-commerce, Portals, and Forums are available now.
Download today and enter to win an XBOX or Visual Studio .NET.
http://aspnet.click-url.com/go/psa00100003ave/direct;at.aspnet_072303_01/01
_______________________________________________
Opensymphony-webwork mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/opensymphony-webwork

Reply via email to