IMHO.. The simple design is to do all validation in your business logic classes & none elsewhere. Easier to maintain & less code. Business logic classes shouldn't make any assumptions that validation has already been done in the GUI so anything done in the GUI must still be duplicated in the business logic. I'd recommend starting this way & adding validation to the GUI later in the project when you've proved you need it. A golden rule is to get the functions of your system working & debugged then make it fast & pretty. Since systems are usually late your business would rather go live missing speed & prettiness than missing functionality! As usual there are exceptions:- - you business classes are expensive to call AND your users DO make lots of validation errors. - your business is so driven by hype that a flash user interface is worth a lot to it.
In fact i tend to think if you want validation before your business logic is reached it's best in javascript on your form & never do it in formbeans. Keith. --- "Tom Klaasen (TeleRelay)" <[EMAIL PROTECTED]> wrote: > FWIW, according to the book "professional site programming" which I > started to read recently, the recommended design pattern is to do > "basic" validation in the ActionForm (is a number, is a date), and the > more business-oriented validation in the Action (is a positive smaller > than 10, is a date AD). > > Ted should be able to correct me on this :) > tomK > > > > -----Original Message----- > > From: Dick Starr [mailto:[EMAIL PROTECTED]] > > Sent: woensdag 23 januari 2002 21:46 > > To: struts-user > > Subject: Should all validation be done in the Action class > > instead of the ActionForm class? > > > > > > I'm new to web apps / struts and wanting know if there is any > > performance > > reason to do initial validation in the ActionForm class (via > > validate="true"). It seems to me that all validation should > > be done in the > > Action class since then all the validation is in one section > > of code and > > since the Action class gets called anyway. Also, I heard that > > there are > > tools to automatically generate the ActionForm classes, which might be > > another argument to not stick any additional code in them (in > > case you want > > to re-generate them). Just wondering ... > > > > Thanks, > > > > Dick Starr > > > > > > -- > > To unsubscribe, e-mail: > > <mailto:struts-user-> [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]> > __________________________________________________ Do You Yahoo!? Great stuff seeking new owners in Yahoo! Auctions! http://auctions.yahoo.com -- To unsubscribe, e-mail: <mailto:[EMAIL PROTECTED]> For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>

