Thanks for all that help. Anyway I guess I'll opt for using custom
exception, like mentioned in an early post, in my business logic
components. Seems easier to do in the interim and I wonder why i didn't
think of that solution myself in the beginning... light...light...

throw new MyBusinessLogicException("error.something.wrong") 
then I'll catch it in the calling execute() and generate an ActionError
with an ActionMessage that I get from the Exceptions getMessage().

At least this works for me as long as I only have one exception message
per problem because business logic won't be processed any further after
that exception, of course. But why should I bother a user with a list of
a 10 issues he did wrong at one time ;-) Let him try again and again
until he got it... Should have read the usage notes in the view before
clicking like mad. ;-)

The simple input validation stuff can still be done in the form's
validate() to notify about all those hundreds of dumb mistakes with
ActionErros.add(). 
So the business logic usually shouldn't throw so many different problems
at one time after validate(). I guess if my database connection is dead
or the transaction had to rollback there's not much more to say than
"bad luck, try again" and further processing makes no sense anyway.

Michael

> -----Original Message-----
> From: Craig R. McClanahan [mailto:[EMAIL PROTECTED]] 
> Sent: Dienstag, 4. Februar 2003 04:49
> To: Struts Users Mailing List
> Cc: [EMAIL PROTECTED]
> Subject: Re: Design question: Model component using Business 
> logic beans
> 
> 
> 
> 
> On Mon, 3 Feb 2003, BaTien Duong wrote:
> 
> > Date: Mon, 3 Feb 2003 20:02:41 -0700
> > From: BaTien Duong <[EMAIL PROTECTED]>
> > Reply-To: Struts Users Mailing List <[EMAIL PROTECTED]>
> > To: Struts Users Mailing List <[EMAIL PROTECTED]>,
> >      [EMAIL PROTECTED]
> > Subject: Re: Design question: Model component using Business logic 
> > beans
> >
> > We use chained exception from jdk1.4, commons.logging, and 
> factoring 
> > out 4 components that are independent on Struts [MessageResources, 
> > MessageResourcesFactory, PropertyMessageResources, and 
> > PropertyMessageResourcesFactory]. I heard somewhere that these 4 
> > components will eventually be in commons. ActionErrors and 
> ActionError 
> > are used at the web layer. With many TilesAction(s) in 1 page, we 
> > coordinate the error handling of the page via the ERROR_KEY 
> attribute 
> > of the request.
> >
> 
> The refactoring of the resources code to make it independent 
> of Struts has been completed:
> 
 
http://jakarta.apache.org/builds/jakarta-commons/nightly/commons-resourc
es

However, it was too late in the 1.1 release cycle to make Struts use
this new code itself.  That will happen in a future version, but you can
use commons-resources for your business tier message resource needs in
the interim.

> Hope this may help.
> BaTien

Craig


---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to