Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

Code Block
languagejava
/** 
 * If there's an ActionBean present, send the user back where they came from with 
 * a stern warning, otherwise send them to the global error page. 
 */ 
public void handle(Throwable throwable, HttpServletRequest request, HttpServletResponse response) throws ServletException { 
    ActionBean bean = (ActionBean) 
    request.getAttribute(StripesConstants.REQ_ATTR_ACTION_BEAN); 

    if (bean != null) { 
        bean.getContext().getValidationErrors().addGlobalError(new SimpleError("You made something blow up! Bad user!")); 
        bean.getContext.getSourcePageResolution().execute(request, response); 
    } 
    else { 
        request.getRequestDispatcher("/error.jsp").forward(request, response); 
    } 
} 

...