There would a few pros and cons for each of the approaches you mention,
making the choice difficult.

A third approach is to have the validation extracted into another set of
classes, so that neither the ActionForm nor the Action itself contain the
real validation logic. The mapper framework I'm working on does such a
thing. I've made an early release available on Ted Husted site
(http://www.husted.com/about/struts/resources.htm#extensions) if you're
curious.

Fr.


-----Original Message-----
From: Gogineni, Pratima [mailto:[EMAIL PROTECTED]]
Sent: 29 June 2001 18:45
To: '[EMAIL PROTECTED]'
Subject: RE: validation


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?

-----Original Message-----
From: Gogineni, Pratima 
Sent: Friday, June 29, 2001 9:41 AM
To: '[EMAIL PROTECTED]'
Subject: validation


Hi,

I have a design question about validation in struts. So far I had been doing
most of my validation in my action classes rather than in my actionform.

I was just looking into moving some of the validation into the validate
method of the action form and find that I have to access some information in
the servlet context to do this since the action form itself does not have
all the information to do the complete validation.

I was thinking that this has a couple of problems - 
1. performance since I have to access the same info again in the action
classes. 
2. I feel it is messy because I am making my actionform which is just a
piece/view of the whole picture access information that is outside the view
itself ...

All of the above leads me to believe that most of the heavy duty validation
should happen in the action class. The actionform only does some minor
validation like maybe checking for null (basically just using the
information it knows).

I which case should we not have a validate method in the action classes too?

Please let me know if I am missing something / got something wrong ...

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