I seriously doubt, that the approach " handle (ALL) types of validation in
the SAME class" is practical: The Validation taht takes place in the from
class happens a semantic level: It just checks, wether the entered values
are in a valid format(this even applies to mandatory field, as NULL is not
a valid format for the field) - exactly where a validation against
business-rules happens is highly-architecture dependent and so you cannot
even be sure, that an action-class is the architectural right place to
perform validation: There are a lot of projects where the action classes
either work as BusinessDelegates or access BusinessDelegates, that
delegate their calls to ejb or whatever. In simpler, less-tiered system
you may have action-classes that do the validation against businessrules
themself.

What indeed may be missing is a unified approach not handle validation but
how to handle validation errors:
1) semantic errors: The Action is never invoked, request is immerdiately
returned to input.
2) business-rule violations: They finally arrive in the action and you
have to put set some kind of errors and forward to an errorhandler page.

The questions seems to me, if there is a) need to unify this handling b)
possibility to implement such a unified handling


 --- Ursprüngliche Nachricht ---
Datum: 15.01.2003 11:44
Von: Gemes Tibor <[EMAIL PROTECTED]>
An: "Struts Users Mailing List" <[EMAIL PROTECTED]>
Betreff: Re: [Gurus Invited] Why not an Action Based Validator?

> 2003. január 15. 11:30 dátummal Phase Web and Multimedia ezt írtad:
> > But that is my whole point. Complex validation or not. Why don't we
handle
> > both types of validation in the SAME class. I don't want to beat this
into
> > the ground. But, it just seems organizationaly better in my mind to
handle
> > validation on the Action level. With all the great minds on this
project I
> > am certain that there is a good design reason for placing validate in
the
> > ActionForm. I am just curious what it is.
>
> I use the validator framework to ensure that the Form property (type
String)
> can be converted to BigDecimal/Date/int.
>
> If I reuse a Form I want to reuse these validations as well. This can be
done
> if the validation is coupled with the form imho.
>
> No one is forced to use this approach however. You can implement the
other one
> by creating a new BaseForm base class which has the a function with the
same
> functionality as the ValidatorActionForm.validate(...) under a different

> name.  Set up the validator framework properly. This ensures client side

> validations, but the server side validation won't occure. Now call the
> renamed form's validation function in your BaseAction's validate
method.
>
> Tib
>
> --
> To unsubscribe, e-mail:
<mailto:[EMAIL PROTECTED]>
> For additional commands, e-mail:
<mailto:[EMAIL PROTECTED]>
>
>



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

Reply via email to