glassfish_at_javadesktop.org wrote:
>Can any one confirm this?
>
>The following code does not produce the desired result:
>
><html>
><head>
><title>Insert title here</title>
></head>
><body>
>This is a test
><%
>response.flushBuffer();
>Thread.sleep(5000);
>%>
></body>
></html>
>
>that is, it only displays the text after 5 seconds. Is this a bug?
>
>
>
The container behaves correctly.
Since JSP pages are buffered by default, the above
code causes the response headers to be flushed and
returned to the client immediately when response.flushBuffer()
is called (you can verify this by accessing the JSP via telnet),
but by the time the sleep statement is reached, no output has
been written to the response (since, I repeat, the JSP page's
output is buffered).
To unbuffer your JSP page, add this page directive at the
beginning:
<%@ page buffer="0kb"%>
Jan