You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by Niall Pemberton <ni...@blueyonder.co.uk> on 2004/07/02 13:36:27 UTC

Re: Contextual Validation

ValidatorForm and ValidatorActionForm have recently changed so that the name
to use for validation is been factored out into a separate method. If you
take a look at the latest ValidatorActionForm it now only consists of the
getValidationKey(ActionMapping, HttpServletRequest) method:

http://cvs.apache.org/viewcvs.cgi/jakarta-struts/src/share/org/apache/struts/validator/

Can could leave your inheritance hierarchy as it is and override thiis new
getValidationKey() method to determine the validation name?

This will be part of the next release which should be imminent.

Niall

----- Original Message ----- 
From: "William Ferguson" <Wi...@hubbub.com.au>
To: "'Struts Users Mailing List'" <us...@struts.apache.org>
Sent: Friday, June 25, 2004 12:23 AM
Subject: RE: Contextual Validation


> 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:ksitron@elp.rr.com]
> 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: user-unsubscribe@struts.apache.org
> >For additional commands, e-mail: user-help@struts.apache.org
> >
> >
> >
> >
>
> -- 
>
> Kevin J Citron
> Sr. Object Imagineer
> Optimized Objects, Inc.
> EL Paso, Texas 79930
> (915) 565-7785/566-2403
>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
> For additional commands, e-mail: user-help@struts.apache.org
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
> For additional commands, e-mail: user-help@struts.apache.org
>
>
>



---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org