Jan and everyone else that helped out, Thanks. I've ended up _not_ doing the validation in the FormBean for a similar reason - one FormBean services multiple forms and it seemed like an improper mixing of MVC layers. The Action knows what is being done so it can do (or direct) the proper validations using a validate() method on the business logic classes. I may take a performance hit but it isn't a big one as far as I can tell. I also think that the maintainance of the source is improved as all validations are grouped into the same section of the code instead of being spread out between the View and Model code.
Kevin. --- Jan Vermeir <[EMAIL PROTECTED]> wrote: > Hi Kevin, I agree with your opinion on the validate() method. We're > using a > single form per application so it is impossible for the validate() > method to > find out what validation to perform. Therefore we use action logic > to do > validations. Only type validations are done in the setter methods > of > attributes. This seems to work fine. > > We also decided to do the String conversions for attributes in a > wrapper > class. This is mostly generated code that calls setter methods on a > bean, > accepting Strings as input. This way our code has a handle to do > more > advanced error handling on the attribute level. One implementation > of our > generator creates code for every attribute that stores a copy of > the value > entered by the user so it may be send back if there is an error > (e.g. an > error in a Date value), providing the user with a chance to correct > the > value without having to type it all over again. I'm not sure if > Struts > should be handling this kind of stuff, but it didn't seem to work > in the > version we started out with. > > Regards, Jan Vermeir > > >From: Kevin HaleBoyes <[EMAIL PROTECTED]> > >To: Westfall Chad > <[EMAIL PROTECTED]>,[EMAIL PROTECTED] > >Subject: RE: [MVC-Programmers] How best to split the layers of MVC > >Date: Fri, 20 Sep 2002 09:05:39 -0700 (PDT) > > > >Thanks for you help! > > > >The DTOs make perfect sense. I've a question though. > > > > > The forms validate method > > > should only perform simple input validations such as; > > > make sure the field is > > > not empty or that it has enough characters etc. > > > >The knowledge of the format of a field or whether that field is > >required or not is dependant on the business logic. > >Consider two separate > >forms at two different companies both collecting the first and > last > >name of a user. At company A the first name is required but it is > >optional at company B. The requiredness of a field depends on the > >business. Both companies also have a WidgetId field input by the > >user but you can be pretty sure that the format of the WidgetId at > >company A is different to that of company B. The format of the > >WidgetId field is dependant on the business logic. > > > >For these reasons, I haven't been using the validate() method of > >the ActionForm or the Validator plugin which both sit at the View > >level. Instead I use the Model classes to validate all input. > > > >Comments? > >Again, thanks for you help. > >Kevin. > > __________________________________________________ Do you Yahoo!? New DSL Internet Access from SBC & Yahoo! http://sbc.yahoo.com _______________________________________________ MVC-Programmers mailing list [EMAIL PROTECTED] http://www.netbean.net/mailman/listinfo/mvc-programmers