All our Forms already extend from ValidatorForm (like yours right at the top
of the inheritance hierarchy). But now I need Actions that use the same Form
to validate differently. This can be achieved using a ValidatorActionForm
but would require either

1) changing the Form hierarchy to extend from ValidatorActionForm (instead
of ValidatorForm). Not possible since the hierarchy is used by other
projects which would then break.
2) duplicating the Form inheritance hierarchy based on ValidatorActionForm
(instead of ValidatorForm) and introducing new validations keyed on the
Action path.

I don't like option 2 because of :
a) the duplication of the Form inheritance hierarchy
b) it mixes the way that validation is determined (ie either tied to Form or
Action) within the application, and the distinction is hidden as it is based
on the root Form class. Ie it is not visible in the struts-config etc.

Is there any other solution?
Eg is there a means of defining what validation to perform from within the
ActionConfig?

William

-----Original Message-----
From: ksitron [mailto:[EMAIL PROTECTED]
Sent: Friday, 25 June 2004 12:56 AM
To: Struts Users Mailing List
Subject: Re: Contextual Validation


I had the same problem. At the top of the inheritance hierarchy, I 
simply changed ActionForm to ValidatorForm.
Non of the other code was broken or disturbed in anyway. Since 
ValidatorForm isA ActionForm.

William Ferguson wrote:

>I would like to be able to specify for an Action the validation that should
>be performed on it.
>
>I can't use a ValidatorActionForm as this is an existing application with
>much baggage and I won't be able to change the inheritance hierarchy of the
>existing Forms. And in any case I will want to be able to occassionally
>share the validation amongst several actions which is not achievable using
>the ValidatorActionForm without copying the validation (something I am
loath
>to do).
>
>It seems to me that it makes sense to specify the validation to use, on the
>ActionConfig. Ie instead of specifying whether to validate the Request or
>not (on the ActionConfig), instead specify which validation to apply. This
>would allow the most flexibility as it removes the need for a dinstinction
>to be made between either a ValidatorForm or ValidatorActionForm.
>
>Is there any mechanism (other than using a ValidatorActionForm) that will
>allow me to do this?
>
>We're using currently Struts-1.1 though I could probably push for a move
>forward reasonably readily.
>
>
>William
>
>---------------------------------------------------------------------
>To unsubscribe, e-mail: [EMAIL PROTECTED]
>For additional commands, e-mail: [EMAIL PROTECTED]
>
>
>  
>

-- 

Kevin J Citron
Sr. Object Imagineer
Optimized Objects, Inc.
EL Paso, Texas 79930
(915) 565-7785/566-2403



---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to