Oh, Struts 1 :) It might be easier to put a business object into the ActionForm.
There are lots of ways to go about all this, but in general, I did *only* simple form-based validation on the Struts side of things, whether or not I had an embedded business object. On the non-form side of things I still had validation error message keys, sometimes tied to a form field, but generally not, but any mapping of business-stuff to form-stuff happened in a layer between Struts and the business stuff. There are a ton of ways to go about gluing it all together, my only real rule-of-thumb was that the form validation ("the easy stuff") was handled via Struts, everything else was handled by a middle layer that took business rule validation issues and mapped them into things that Struts could comprehend (ActionErrors, possibly tied to a form property). It'd be better (from where I sit, anyway) to call business validation rules from Struts rather than the other way around. d. --- CrackheadMillionaire <[EMAIL PROTECTED]> wrote: > Hi Dave - > > Thanks for the quick reply! > > Well, I guess my initial thought was, why not find a way to call the form > bean's validate(mapping, request) method. This would generate a list of > action errors for me that didn't fit the rules defined in validator.xml; I > could append any complicated rules I've found that I had violated, and > return the whole world to either my DispatchAction who could set and > return, or to my other process who could be made to understand an > ActionError and act appropriately. > > But to do that, my business layer needs to have a mapping and request > method. If I'm accessing the business layer from outside of the web > environment, that seems pretty hacky to create and populate a mapping and > servlet request. > > Maybe I'm gonig about this all wrong / missing something big? (sorry) > > - cm > > > ----- Original Message ---- > From: Dave Newton <[EMAIL PROTECTED]> > To: Struts Users Mailing List <user@struts.apache.org> > Sent: Tuesday, December 11, 2007 6:49:33 PM > Subject: Re: Tying validation into Business Layer > > --- CrackheadMillionaire <[EMAIL PROTECTED]> wrote: > > but I can't see how to expose it to a business layer without mandating it > > accept some ackward objects that are specific to struts. > > What Struts-specific objects do you think you'd need to expose? > > d. > > > --------------------------------------------------------------------- > To unsubscribe, e-mail: [EMAIL PROTECTED] > For additional commands, e-mail: [EMAIL PROTECTED] > > > > ____________________________________________________________________________________ > Never miss a thing. Make Yahoo your home page. > http://www.yahoo.com/r/hs --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]