How about catching the database exception in the middle
tier and throwing a more middle tier like Exception (so
your front tier - any of the struts classes - don't have
to deal with anything with SQL in it) that you define like
UserExistsException or InvalidSomethingException or
ThisHappenedException and then in the struts config have 

  <global-exceptions>

          <exception 
                key="errors.user.exists" 
                type="my.exception.UserExistsException" 
                path="doc.explainUserError"  //If you were using tiles defs
                              //or the JSP name otherwise 
         />

  </global-exceptions>

I like keeping the try catches out of my Action class.


-----Original Message-----
From: Leon [mailto:[EMAIL PROTECTED] 
Sent: Tuesday, May 27, 2003 3:33 PM
To: Struts Users Mailing List
Subject: Re: Newbie question: how does MyAction class handle Exceptions?

I should forward an ApplicationException to MyAction class and then,
MyAction finds an appropriate jsp based on the message in
ApplicationException. But, how can I know the SQLException thrown by
persistance tire is duplicate entery SQLException or other SQLException?
Thanks.


----- Original Message -----
From: "Mike Jasnowski" <[EMAIL PROTECTED]>
To: "Struts Users Mailing List" <[EMAIL PROTECTED]>
Sent: Tuesday, May 27, 2003 2:45 PM
Subject: RE: Newbie question: how does MyAction class handle Exceptions?


> Return a forward appropriate to the exception caught?
>
> -----Original Message-----
> From: Leon [mailto:[EMAIL PROTECTED]
> Sent: Tuesday, May 27, 2003 2:45 PM
> To: Struts Users Mailing List
> Subject: Newbie question: how does MyAction class handle Exceptions?
>
>
> Hi,
>
> I have DataAccessException thrown by DAO class and catched by
> BusinessDeligate class. ApplicationException thrown by BusinessDeligate
> class and catched by MyAction class. I want to send a jsp to clients to
> display a message that the clients submit a duplicate entry in their
> request. What should I do for this?
> Thanx.
>
> Leon
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
>
>

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

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

Reply via email to