tomcat-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Tim Funk <funk...@joedog.org>
Subject Re: jsp include/RequestDispatcher incompatible?
Date Wed, 29 Jun 2005 17:53:06 GMT
Try flush first, otherwise you might need to pass a 
HttpServletResponseWrapper() to include() where the wrapper oversrides 
getOutputStream() (or getWriter()

-Tim

George Finklang wrote:
> So before each request dispatcher call I need to call a flush on the
> out in the JspPage?  How do I get access to it?
> 
> Do I also need to call flush at the end of each request dispatcher call?
> 
> --George
> 
> On 6/28/05, Tim Funk <funkman@joedog.org> wrote:
> 
>>The out from the jspwriter is NOT the same out as receieved by
>>response.getWriter();
>>
>>The out in the JspPage is  buffered.
>>
>>-Tim
>>
>>George Finklang wrote:
>>
>>
>>>have the following code in my jsp, which is called by a forward from my
>>>Controller servlet. The various Dispatchers are either servlets or jsps declared
>>>in my web.xml.
>>>
>>>All the servlets and jsps get run correctly. The problem is the output. The
>>>output of the root jsp and the 3-4 included jsps are arbitrarily rearranged, see
>>>below. Bizarre shuffling, not reverse order, but a different order and not
>>>interleaved with the text from the jsp.
>>>
>>>If I translate the jsp into servlet code, and use RequestDispatchers
>>>for all the components,
>>>the page works.  The documentation says something about flushing buffers, but
I
>>>can't see how to do this with RequestDispatchers.
>>>
>>>
>>>Code:
>>>
>>><BODY>
>>><jsp:include page="WEB-INF/jsps/portal/header.jsp" flush="true"/>
>>><% if(option1) {
>>>    application.getNamedDispatcher("Option1Servlet").include(request,response);
>>>    } else { %>
>>><table><tr>
>>><% if(option2) { %>
>>><td><%
>>>
>>>application.getNamedDispatcher("Option2Servlet").include(request,response);
>>>%></td>
>>><%  } %>
>>><td><%
>>>       application.getNamedDispatcher(page).include(request,response); %></td>
>>><td><%
>>>       application.getNamedDispatcher("InfoServlet").include(request,response);
>>>%></td>
>>></tr></table>
>>><%  } %>
>>></BODY>
>>>
>>>
>>>
>>>generated html:
>>>
>>><BODY>
>>>
>>>
>>>Page text          // from the page dispatcher
>>>
>>>Info servlet text   // from the infoservlet dispatcher
>>>
>>>Header form text // from the header.jsp dispatcher
>>>
>>>
>>><table><tr>
>>>
>>><td></td>
>>><td></td>
>>></tr></table>
>>>
>>></BODY>
>>>
>>>---------------------------------------------------------------------
>>>To unsubscribe, e-mail: tomcat-user-unsubscribe@jakarta.apache.org
>>>For additional commands, e-mail: tomcat-user-help@jakarta.apache.org
>>>
>>>
>>>
>>
>>---------------------------------------------------------------------
>>To unsubscribe, e-mail: tomcat-user-unsubscribe@jakarta.apache.org
>>For additional commands, e-mail: tomcat-user-help@jakarta.apache.org
>>
>>
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: tomcat-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: tomcat-user-help@jakarta.apache.org
> 
> 
> 

---------------------------------------------------------------------
To unsubscribe, e-mail: tomcat-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: tomcat-user-help@jakarta.apache.org


Mime
View raw message