tomcat-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Maverick, Vance" <>
Subject Bug: forward / include
Date Fri, 23 Jun 2000 01:49:08 GMT
I think this is closely related to the bug reported by Todd Fast on the 15th
of June.  (See

We're trying to port an existing JSP-based web application to Tomcat 3.1 /
JSP 2.2.  The general design is a "gatekeeper" servlet, which forwards
requests to JSPs.  This works fine, except in the case of a few JSPs, which
themselves use <jsp:include> directives to dispatch dynamically.  They throw
the exception

java.lang.IllegalStateException: Response has already been committed
	at org/apache/tomcat/core/HttpServletResponseFacade.sendError
	at org/apache/jasper/runtime/JspServlet$JspServletWrapper.service
	at org/apache/jasper/runtime/JspServlet.serviceJspFile
	at org/apache/jasper/runtime/JspServlet.service
	at javax/servlet/http/HttpServlet.service (
	at org/apache/tomcat/core/ServletWrapper.handleRequest
	at org/apache/tomcat/core/RequestDispatcherImpl.include
	at org/apache/jasper/runtime/PageContextImpl.include

I was able to replicate this problem with a minimal set of files -- see
below.  Is this a real bug, or an error on our part?  If it's a bug, is
there a fix planned?  And is there a workaround?  Thanks,


The servlet is in a package "test", and the JSPs are in a virtual directory

-- begin test/ --
package test;

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

 *  Simplest possible test of problem configuration:
 *  servlet forwards request to JSP, JSP includes another.
public class Test
    extends HttpServlet
    public void doGet(HttpServletRequest request,
                      HttpServletResponse response)
        throws ServletException, IOException
        RequestDispatcher rd =
        rd.forward(request, response);

-- begin /test/Outer.jsp --
<title>Include test</title>
This is a test of forwarding and inclusion.  For some reason, it's not
working right for us with Tomcat.

<jsp:include page="/test/Inner.jsp" flush="true" />

-- begin /test/Inner.jsp --
This is an inner file included via &lt;jsp:include&gt;.

View raw message