Hi all,

I recently started working with Tomcat (4.1.29) and ran into an inconsistency between 
the implicit "out" variable in a JSP and response.getWriter().  Consider this JSP:

<html>
<body>
Me first.
<% response.getWriter().println("Me second"); %>
</body>
</html>

I was surprised to discover that the out of this is:

Me second.
<html>
<body>
Me first.
</body>
</html>

Looking at org.apache.jasper.runtime.PageContextImpl and JspWriterImpl, it appears 
that the "out" variable is set up
with its own buffer, which explains why text sent straight to the response writer 
appears first (before the JSP writer buffer gets flushed).

Am I missing something or is this the way it actually works?  If I have it straight, 
is this a bug?  I'm not sure about the
JSP spec, but other app servers I've tried seem to accumulate text in a single buffer 
for both "out" and response.getWriter().

Thanks,

Karl Goldstein

Reply via email to