You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by Mike Jasnowski <mj...@bea.com> on 2003/05/27 20:45:00 UTC

RE: Newbie question: how does MyAction class handle Exceptions?

Return a forward appropriate to the exception caught? 

-----Original Message-----
From: Leon [mailto:leonnewsgroup@hotmail.com]
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: struts-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: struts-user-help@jakarta.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: struts-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: struts-user-help@jakarta.apache.org


Re: Newbie question: how does MyAction class handle Exceptions?

Posted by Erik Price <ep...@ptc.com>.

Leon wrote:
> 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?

Put an informative message in the DAO code that constructs the SQLException.

Some people then generate an email from the exception message and send 
it to the administrator email account.  Other people might do something 
more technical such as send a JMS message that there is a problem.  Or 
even open a socket and fire a simple XML message to some web service 
containing the contents of the exception.  These ideas require you to 
have established a facility to receive and store such messages (JMS or 
web service), and might not be worth the added complexity.

Other people don't care if the user sees the exception message and they 
just print a message like "Please copy the contents of this stack trace 
into an email and send it to the admin".  This is the easy, if ugly, 
solution.


Erik


---------------------------------------------------------------------
To unsubscribe, e-mail: struts-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: struts-user-help@jakarta.apache.org


Re: Newbie question: how does MyAction class handle Exceptions?

Posted by Leon <le...@hotmail.com>.
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" <mj...@bea.com>
To: "Struts Users Mailing List" <st...@jakarta.apache.org>
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:leonnewsgroup@hotmail.com]
> 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: struts-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: struts-user-help@jakarta.apache.org
>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: struts-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: struts-user-help@jakarta.apache.org
>
>

---------------------------------------------------------------------
To unsubscribe, e-mail: struts-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: struts-user-help@jakarta.apache.org