Please help me resolve this problem.  I've tried comparing generated code to
no avail - the only difference is the package statement.

I call an xslt servlet (that returns formatted html output to the JSP
response Writer)  via a <jsp:include> action from a jsp page,
xsltTransform.jsp.
If I put the same xsltTransform.jsp page in different Tomcat web application
directories, in one it runs, in another I get a "Response already committed"
error when the servlet tries to write to the response Writer.

In the case where the jsp page runs, a call to response.isCommitted() within
the servlet, prior to the XSLT transformation writing to the JSP Writer,
returns true (due to the automatic flush prior to the
pageContextImpl.include() call) .

Has anybody run into this before?  What determines whether a committed
response object can be flushed or written to without a  "response committed"
error?  (I have set the contentLength of the response object to prevent
writing due to buffer overflow).

Here are the guts of my servlet doGet() code:
// Assume size of html output will be 1.5 times the size of the dataSetSize
          dataSetSize *= 1.5;

          response.setContentLength(dataSetSize);

        // Process the transformation.
          if(response.isCommitted()){
                System.out.println("*****  WARNING 2:  Response is committed
prior to XSLT call.  Flushing writer.  *****");
                response.getWriter().flush();
          }
        try {
              XSLTProcessor processor = XSLTProcessorFactory.getProcessor();

                  processor.process( new XSLTInputSource( dataInputStream ),

                               new XSLTInputSource( stylesheetInputStream ),
                                         new XSLTResultTarget(
(java.io.Writer )response.getWriter() ) );

        }

Here is my xsltTransform.jsp code:

if(request.getParameter("list")!=null){
                                String list = request.getParameter("list");
                        %>
                                <BR><BR><b><%=list%> List:  </b><BR>
                        <%      if(list.equals("Associates")){%>

                                <jsp:include
page="/servlet/development.util.XSLTServlet?list=Associates&xslFileName=d:\\
training\\development\\data\\associates.xsl&xmlFileName=d:\\training\\develo
pment\\data\\brp.xml&clientURL=/beach/jsp/xslTransform.jsp?list=Associates&g
etResults=false" flush="true"/>

                        <%      }

Please RSVP!

Thanks,

Tim Hengst
Tampa, FL


Reply via email to