You need to be using
<jsp:include page="/foo.html" />

Under the covers getOutputStream during the include. But a getWriter was already called. Once you call getWriter - you can't call getOutputStream, or you get the ISE.

jsp:include gets aroung this by wrapping the response and wrapping getOutputStream to avoid this issue.

-Tim

j.random.programmer wrote:
Is this my imagination or is tomcat really this
retarded and this insanely buggy ? Or am I doing something wrong ?

----------------- x.jsp --------------------------
foo

<%
RequestDispatcher rd =
request.getRequestDispatcher("/foo.html");
rd.include(request, response);
%>

test;
-----------------end---------------------------------

------------- start foo.html ------------------------
This is a foo page, with some dummy html
-------------------------------------------------

Now, when i try to get "x.jsp", I get:

HTTP Status 500 -

type Exception report
message
description The server encountered an internal error
() that prevented it from fulfilling this request.
exception
org.apache.jasper.JasperException: getOutputStream()
has already been called for this response

org.apache.jasper.servlet.JspServletWrapper.handleJspException(JspServletWrapper.java:510)

org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:387)

org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:314)

org.apache.jasper.servlet.JspServlet.service(JspServlet.java:264)

javax.servlet.http.HttpServlet.service(HttpServlet.java:802)

root cause
java.lang.IllegalStateException: getOutputStream() has
already been called for this response

org.apache.catalina.connector.Response.getWriter(Response.java:599)

org.apache.catalina.connector.ResponseFacade.getWriter(ResponseFacade.java:195)

org.apache.jasper.runtime.JspWriterImpl.initOut(JspWriterImpl.java:124)

org.apache.jasper.runtime.JspWriterImpl.flushBuffer(JspWriterImpl.java:117)

org.apache.jasper.runtime.PageContextImpl.release(PageContextImpl.java:191)

org.apache.jasper.runtime.JspFactoryImpl.internalReleasePageContext(JspFactoryImpl.java:115)

org.apache.jasper.runtime.JspFactoryImpl.releasePageContext(JspFactoryImpl.java:75)
        org.apache.jsp.vbb.x_jsp._jspService(x_jsp.java:56)

org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:97)

javax.servlet.http.HttpServlet.service(HttpServlet.java:802)

org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:332)

org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:314)

org.apache.jasper.servlet.JspServlet.service(JspServlet.java:264)

javax.servlet.http.HttpServlet.service(HttpServlet.java:802)

note The full stack trace of the root cause is
available in the Apache Tomcat/5.5.16 logs.

---------------------------------------------------------------------
To start a new topic, e-mail: users@tomcat.apache.org
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to