You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tomcat.apache.org by Manri Offermann <ma...@globalscale.net> on 2001/09/28 17:47:48 UTC

[TC4] error-page exception is null

Hi,

I am trying to display a custom error page. Everything works fine, when
throwing errors from a JSP page, but when I throw an error from a Servlet,
the exception I receive on the error page is null. Why? The same code worked
on Tomcat 3.2

Test Servlet:
=======================================================
import java.io.IOException;

import javax.servlet.http.*;
import javax.servlet.*;

public class Test extends HttpServlet {
 public void service(HttpServletRequest request, HttpServletResponse
response) throws ServletException, IOException {
  throw new ServletException("Test");
 }
}

web.xml:
=======================================================
 <error-page>
  <exception-type>javax.servlet.ServletException</exception-type>
  <location>/err.jsp</location>
 </error-page>
 <error-page>
  <exception-type>java.lang.Exception</exception-type>
  <location>/err.jsp</location>
 </error-page>


err.jsp:
=======================================================
<%@ page isErrorPage="true" %>

<%=exception%>   <---- is null from a servlet, and ok if from a JSP



manri