FileDocCategorySizeDatePackage
CustomExceptionHandler.javaAPI DocExample1708Sat Aug 14 14:50:56 BST 2004com.oreilly.strutsckbk.ch09

CustomExceptionHandler

public class CustomExceptionHandler extends org.apache.struts.action.ExceptionHandler

Fields Summary
Constructors Summary
Methods Summary
public org.apache.struts.action.ActionForwardexecute(java.lang.Exception ex, org.apache.struts.config.ExceptionConfig ae, org.apache.struts.action.ActionMapping mapping, org.apache.struts.action.ActionForm formInstance, javax.servlet.http.HttpServletRequest request, javax.servlet.http.HttpServletResponse response)

        // TODO Add custom code here to completely control handling
        return super.execute(ex, ae, mapping, formInstance, request, response);
    
protected voidlogException(java.lang.Exception e)

        // TODO Add custom code here for exception logging
        System.out.println("Customized logException for:"+e);
        super.logException(e);
    
private voidsaveMessage(java.lang.String msg)

        // store error message in database ...
    
protected voidstoreException(javax.servlet.http.HttpServletRequest request, java.lang.String property, org.apache.struts.action.ActionMessage error, org.apache.struts.action.ActionForward forward, java.lang.String scope)

        MessageResources msgRes = MessageResources.getMessageResources("ApplicationResources");
        String msg = msgRes.getMessage(error.getKey());
        saveMessage(msg);
        super.storeException(request, property, error, forward, scope);