When I say I have my validation logic in the perform method - I just mean
that this is where I am doing the validation. But the logic (most of it) is
in separate classes. I would guess this is upto the user to decide whether
to put in the perform method directly or use classes of their own for
validation.

Did you mean something else when you say validation in separate classes?
Also I image the business logic validation is highly specific to the
situation and I cant think what kind of framework you can provide for this -
other than just call a validate method ...

thanks
pratima

-----Original Message-----
From: Rey Francois [mailto:[EMAIL PROTECTED]]
Sent: Monday, July 02, 2001 9:48 AM
To: '[EMAIL PROTECTED]'
Subject: RE: validation



Ted,

Do you think this approach of splitting validation between both the
ActionForm.validate() and the Action.perform() is the most desirable?
Somehow I have the feeling that by extracting these validations into
separate classes is a better approach because it makes it easier to reuse
the validation logic, which is one of the benefit of having validation
framework. The real question then is whether this framework should only do
the domain-type checking or should also support the business logic checking.
I think it should support both, especially if you can also separate them
within the same framework.

Fr.

-----Original Message-----
From: Ted Husted [mailto:[EMAIL PROTECTED]]
Sent: 02 July 2001 18:04
To: [EMAIL PROTECTED]
Subject: Re: validation


The general thinking is that there are at least two levels of
validation. First, there is the simple domain-type checking, such as
fields that are suppose to be numeric should contain only numerals.
Second, there is business-logic checking, like invoice numbers are all
greater than 1000 or no start dates should occur before 1984, or that
the username and password match. 

The first type is easy to automate and doesn't require access to the
business logic, so we have a standard method that you can override if
you want to do that as part of your ActionForm. With that method, there
would not be a good place for you to plug-in simple validations.

The second type gets to be application specific, and is usually handled
in the Action perform method. Since you are already overriding perform,
there didn't seem to be much value in providing a yet another method to
override here. 

-- Ted Husted, Husted dot Com, Fairport NY USA.
-- Custom Software ~ Technical Services.
-- Tel 716 737-3463.
-- http://www.husted.com/about/struts/


"Gogineni, Pratima" wrote:
> Please let me know if I am missing something / got something wrong ...
>
>I which case should we not have a validate method in the action classes
too?
>
> On second thoughts ...I guess if there is some validation common to all
the
> actions its probably better to place it in the actionform even if it means
> looking at information outside the view/form itself?
> I which case should we not have a validate method in the action classes
too?
> 
> Thanks
> Pratima

************************************************************************
The information in this email is confidential and is intended solely
for the addressee(s).
Access to this email by anyone else is unauthorised. If you are not
an intended recipient, you must not read, use or disseminate the
information contained in the email.
Any views expressed in this message are those of the individual
sender, except where the sender specifically states them to be
the views of Capco.

http://www.capco.com
***********************************************************************

Reply via email to