I'm not sure that I follow you...

What I meant was that automatic declarative validation using Struts Validator should be invoked by a "ValidatingAction" baseclass validate() method, rather than DynaValidatorForm (or similar) baseclass validate() method. And that you could put any validation that is too complex to be described declaratively in your overriden Action validate() method.

Where are you suggesting would be a good place for validation to be performed?

From: Dakota Jack <[EMAIL PROTECTED]>
Reply-To: Dakota Jack <[EMAIL PROTECTED]>
To: Struts Users Mailing List <user@struts.apache.org>
Subject: Re: Wouldn't validation be better performed by Actions rather than ActionForms?
Date: Fri, 18 Mar 2005 09:19:10 -0800


I don't think you want an Action doing the validation, but I am with
you that validation does not belong to ActionForm.  You don't have to
do it there, by the way.

Jack


On Fri, 18 Mar 2005 17:17:39 +0000, Lawrie Gallardo
<[EMAIL PROTECTED]> wrote:
> I'm still relatively new to Struts, but I can't help but feel that
> validation would be better performed by Action classes rather than
> ActionForm classes.
>
> It seems to me that, ideally, you want
> 1. Validation,
> 2. Transformations (ie convert separate day, month and year HTML fields to
> Java Date object), and
> 3. Mapping of ActionForm fields (/HTML parameters) to Domain POJOs / DTOs
> to all be configured in the same config file (to minimise duplication) and
> to be implemented in the same class rather than scattered between multiple
> config files and classes.
>
> Now, if my understanding is correct:
> 1. There is always a one-to-one mapping between an ActionForm and an
> ActionMapping,
> 2. Struts best practice is to have each Action class handle all possible
> operations for the HTML request it deals with using DispatchLookupAction or
> something similar,
> 3. Almost noone creates ActionForms manually any more - they use
> DynaActionForm (or validating variations of this). And for those who do
> still create ActionForms manually, they don't offer anything in the way of
> reuse, and are basically throw-away classes.
>
> Now if this is the case, would it not be better to have the ActionForm as
> basically a dum data holder and have the validation method in the Action
> classes instead? The strus-config.xml file could contain all the required
> declarative validation, transformation and mapping info, and the Action
> class could contain any validation, transformation, and mapping operations
> that were too complicated to be set up declaratively.
>
> Is it just down to design decisions made in early versions of Struts and
> backward compatibility that things are the way they are? Or are there good
> arguments for having the validation method in ActionForm? Am I missing
> something here?
>
> _________________________________________________________________
> Stay in touch with absent friends - get MSN Messenger
> http://www.msn.co.uk/messenger
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
>
>



-- "You can lead a horse to water but you cannot make it float on its back." ~Dakota Jack~

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


_________________________________________________________________
It's fast, it's easy and it's free. Get MSN Messenger today! http://www.msn.co.uk/messenger



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



Reply via email to