@Override public ActionForward execute( Exception ex, ExceptionConfig ae, ActionMapping mapping, ActionForm formInstance, HttpServletRequest request, HttpServletResponse response) throws ServletException { super.execute(ex, ae, mapping, formInstance, request, response); ActionForward forward = null; ActionError error = null; String property = null; // Figure out the error if (ex instanceof FenixActionException) { error = ((FenixActionException) ex).getError(); property = ((FenixActionException) ex).getProperty(); } else { error = new ActionError(ae.getKey(), ex.getMessage()); property = error.getKey(); } // Store the exception request.setAttribute(Globals.EXCEPTION_KEY, ex); super.storeException(request, property, error, forward, ae.getScope()); return mapping.findForward("beginTransaction"); }
/** * Handle the exception. Return the <code>ActionForward</code> instance (if any) returned by the * called <code>ExceptionHandler</code>. * * @param ex The exception to handle * @param ae The ExceptionConfig corresponding to the exception * @param mapping The ActionMapping we are processing * @param formInstance The ActionForm we are processing * @param request The servlet request we are processing * @param response The servlet response we are creating * @exception ServletException if a servlet exception occurs * @since Struts 1.1 */ @Override public ActionForward execute( Exception ex, ExceptionConfig ae, ActionMapping mapping, ActionForm formInstance, HttpServletRequest request, HttpServletResponse response) throws ServletException { super.execute(ex, ae, mapping, formInstance, request, response); ActionForward forward = null; ActionError error = null; request.setAttribute(PresentationConstants.ORIGINAL_MAPPING_KEY, mapping); request.setAttribute(PresentationConstants.EXCEPTION_STACK_TRACE, ex.getStackTrace()); if (ae.getScope() != "request") { ae.setScope("request"); } String property = null; // Figure out the error if (ex instanceof FenixActionException) { error = ((FenixActionException) ex).getError(); property = ((FenixActionException) ex).getProperty(); } else { error = new ActionError(ae.getKey(), ex.getMessage()); property = error.getKey(); } // Store the exception request.setAttribute(Globals.EXCEPTION_KEY, ex); super.storeException(request, property, error, forward, ae.getScope()); return super.execute(ex, ae, mapping, formInstance, request, response); }
@Override public ActionForward execute( Exception ex, ExceptionConfig ae, ActionMapping mapping, ActionForm formInstance, HttpServletRequest request, HttpServletResponse response) throws ServletException { super.execute(ex, ae, mapping, formInstance, request, response); ActionMessage error = null; User userView = null; String errorMessage = "message.invalid.password"; // Figure out the error if (ex instanceof InvalidPasswordServiceException) { InvalidPasswordServiceException invalidPasswordServiceException = (InvalidPasswordServiceException) ex; userView = invalidPasswordServiceException.getUserView(); error = new ActionMessage(errorMessage, errorMessage); } // Invalidate existing session if it exists HttpSession sessao = request.getSession(false); if (sessao != null) { sessao.invalidate(); } // Create a new session for this user sessao = request.getSession(true); ActionForward forward = mapping.findForward("changePass"); request.setAttribute(Globals.EXCEPTION_KEY, ex); super.storeException(request, errorMessage, error, forward, ae.getScope()); return forward; }