I don't like to let the exception go as is, since I need the stack trace.
Don't you wanna know what went wrong?

The following works wonderfully, -- I have :-
        <exception
                key="undefined.msgkey"
                path="/SystemFailure"
                type="java.lang.Exception"
                
handler="com.standardandpoors.apps.xw.web.common.controller.MyExceptionHandlerAction"
        />

Note my key!

My system failure URL is mapped in web.xml to a simple JSP with customer 
service tel#.

public class MyExceptionHandlerAction extends ExceptionHandler {
        ....... 
        public ActionForward execute(Exception arg0, ExceptionConfig arg1,
                        ActionMapping arg2, ActionForm arg3, HttpServletRequest 
arg4,
                        HttpServletResponse arg5) throws ServletException {
                return new ActionForward(arg1.getPath());
        }

        protected void logException(Exception arg0) {
                super.logException(arg0);
                logger.log(Level.SEVERE, this.getClass().getName()+ " is 
handling unexpected webapp exception : "+arg0);
                arg0.printStackTrace();
        }
}
> -----Original Message-----
> From: Wendy Smoak [mailto:[EMAIL PROTECTED]
> Sent: Wednesday, November 17, 2004 6:32 PM
> To: Struts Users Mailing List
> Subject: Help with Exception handling
> 
> 
> I know I've tried this before, but so far I haven't gotten 
> all the pieces
> properly arranged so it works. :/
> 
> I currently have code like this in an Action:
>             try {
>                benId = loginDAO.getBenId( asurite );
>             } catch ( TermsAcceptanceException ex ) {
>                return mapping.findForward( "terms" );
>             }
> 
> In struts-config.xml:
>          <action
>             path="/denLogin"
>             type="edu.asu.vpia.struts.DevilsDenLoginAction"
>             name="loginForm"
>             scope="request"
>             validate="true"
>             input="den.login.page">
>                <forward name="success" path="den.login.success"/>
>                <forward name="terms" path="den.terms.agreement" >
>         </action>
> 
> It's my impression that I don't need to catch the exception, 
> that I *should*
> be able to let Action.execute(...) throw it and the framework can be
> configured to deal appropriately with it.
> 
> So I took out this line:
>                <forward name="terms" path="den.terms.agreement" >
> And put in:
>             <exception
>                 type="edu.asu.dao.DAOException"
>                 path="/WEB-INF/error.jsp"
>                 key="error.dao.exception"/>
> 
> And I just get a JSP with a stack trace.  Although 
> TermsAcceptanceException
> extends DAOException, it doesn't go to error.jsp.
> 
> Two questions... what is the 'key' attribute of <exception> 
> used for, and
> can anyone tell what I'm doing wrong?
> 
> Thanks!
> -- 
> Wendy Smoak
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
> 
>
 
 
 
--------------------------------------------------------

 
The information contained in this message is intended only for the recipient, 
and may be a confidential attorney-client communication or may otherwise be 
privileged and confidential and protected from disclosure. If the reader of 
this message is not the intended recipient, or an employee or agent responsible 
for delivering this message to the intended recipient, please be aware that any 
dissemination or copying of this communication is strictly prohibited. If you 
have received this communication in error, please immediately notify us by 
replying to the message and deleting it from your computer.
 
Thank you,
 
Standard & Poor's
 
--------------------------------------------------------

 

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

Reply via email to