tomcat-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Mohun Biswas <>
Subject error-page and POST vs GET
Date Thu, 01 May 2003 20:59:04 GMT
On Tomcat 4.1.24, I set up an error page to handle ServletExceptions, more 
or less like this:


And it works fine. But then I discovered one servlet that wasn't 
redirecting to this page on ServletException. After looking at it a while I 
narrowed it down to this: if the request is a GET, it works fine. If the 
exact same servlet is called with a POST and throws the same exception, it 
doesn't go to the error page. Here's the trimmed-down servlet:

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

public class LabServlet extends HttpServlet {
     public void doGet(HttpServletRequest req, HttpServletResponse res)
         throws IOException, ServletException
         PrintWriter out = res.getWriter();
         throw new ServletException("LAB SERVLET");

     public void doPost(HttpServletRequest req, HttpServletResponse res)
         throws IOException, ServletException
         doGet(req, res);

I could not find anywhere in the Servlet 2.3 API where it implies that 
error pages don't work on POSTs. Anyone know what gives?


To unsubscribe, e-mail:
For additional commands, e-mail:

View raw message