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 Fri, 11 Jan 2002 13:25:19 GMT
At 07:16 11/01/02 -0600, you wrote:
>You could use a JSP error page from a servlet.
>
>Catch any ServletException errors, and do a redirect to your JSP error page.
>
>Here's short snips from one of my servlets:
>try {
>   //sending email from the servlet...
>} catch (ServletException ex) {
>    log("Failure to send email", ex);
>    sendErrorRedirect(req, res, "/error.jsp", ex);
>}
>
>
>protected void sendErrorRedirect(HttpServletRequest request,
>HttpServletResponse response, String errorPageURL, Throwable e) {
>    try {
>       request.setAttribute ("javax.servlet.jsp.jspException", e);
>
>getServletConfig().getServletContext().getRequestDispatcher(errorPageURL).fo
>rward(request, response);
>    } catch (Exception ex) {
>       log(getServletName() + ".sendErrorRedirect ", ex);
>    }
>}
>
>
>Hope that helps...


But, I can't catch ServletException. When I try to catch I get the 
following message:

EnbreveServlet.java:102: exception javax.servlet.ServletException is never 
thrown in body of corresponding try statement
         } catch (ServletException se ) {
           ^



---------------------------------------------------------------------
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