tomcat-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Héctor Garcia Peris <hector.gar...@ivie.es>
Subject RE: Change the default error message
Date Mon, 14 Jan 2002 08:35:40 GMT
At 08:08 11/01/02 -0600, you wrote:
>Oh the dangers of modifying code without first testing it!
>
>I modified that from a plain 'Exception', because I thought I was being
>clever. Catch either the exact specific Exceptions that may be thrown (eg:
>NullPointer, IO) or just catch 'Exception', as I was originally doing.

Well, I can catch Exception, but know it doesn't works the sendRedirect 
method that you has write. I put the following:

         protected void sendErrorRedirect(HttpServletRequest request, 
HttpServletResponse response, String errorPageURL, Throwable e) {
         try {
       //request.setAttribute ("javax.servlet.jsp.jspException", e);
                         getServletConfig().getServletContext().getRequestDispatcher(errorPageURL).forward(request,

response);
         } catch (Exception ex) {
       log(getServletName() + ".sendErrorRedirect ", ex);
         }
         }

And in the catch part:

} catch (Exception ex) {
    sendErrorRedirect(req, resp, "http://hgarcia/error.html", ex);
}

How can I redirect an html page, not a jsp page?

Thanks.



---------------------------------------------------------------------
Héctor Garcia Peris
Dpto. Informática
Instituto Valenciano de Investigaciones Económicas S.A. (Ivie)
C/ Guardia Civil, 22 esc-2 1º 46020 - Valencia (Spain)
Tfno.: +34 - 963190050 / +34 - 963930816
Fax.: +34 - 963190055 / +34 - 963930856
e-mail: hector.garcia@ivie.es
----------------------------------------------------------------------



--
To unsubscribe:   <mailto:tomcat-user-unsubscribe@jakarta.apache.org>
For additional commands: <mailto:tomcat-user-help@jakarta.apache.org>
Troubles with the list: <mailto:tomcat-user-owner@jakarta.apache.org>


Mime
View raw message