question: public static void sendError ( HttpServletRequest request , HttpServletResponse response , int httpStatusCode , String errorCode , String errorMsg ) { if ( ( errorUrl == null ) || ( errorUrl . length ( ) == 0 ) ) { try { response . sendError ( httpStatusCode , errorMsg ) ; return ; } catch ( IOException ioe ) { debug . error ( "CookieUtils.sendError" , ioe ) ; } } else { String jointString = "?" ; if ( errorUrl . indexOf ( "?" ) != - 1 ) { jointString = "&" ; } String newUrl = errorUrl . trim ( ) + jointString + "errorcode=" + errorCode + "&" + "httpstatuscode=" + httpStatusCode + "&" + "errormessage=" + URLEncDec . encode ( errorMsg ) ; if ( debug . messageEnabled ( ) ) { debug . message ( "CookieUtils.sendError: final redirectionURL=" + newUrl ) ; } String tmp = errorUrl . toLowerCase ( ) ; if ( tmp . startsWith ( "http://" ) || tmp . startsWith ( "https://" ) ) { try { response . sendRedirect ( newUrl ) ; } catch ( IOException e ) { debug . error ( "CookieUtils.sendError: Exception " + "occured while trying to redirect to resource:" + newUrl , e ) ; } } else { try { RequestDispatcher dispatcher = request . getRequestDispatcher ( newUrl ) ; dispatcher . forward ( request , response ) ; } catch ( ServletException e ) { debug . error ( "CookieUtils.sendError: Exception " + "occured while trying to forward to resource:" + newUrl , e ) ; } catch ( IOException e ) { debug . error ( "CookieUtils.sendError: Exception " + "occured while trying to forward to resource:" + newUrl , e ) ; } } } }
target:  Sends to error page URL for processing. If the error page is hosted in the same web application, forward is used with parameters. Otherwise, redirection is used with parameters.  Three parameters are passed to the error URL: -- errorcode : Error key, this is the I18n key of the error message. -- httpstatuscode : Http status code for the error -- message : detailed I18n'd error message 