If a page is not buffered, (i.e. directive used is <%@page buffer="none"%> then all the output to the JspWriter is automatically written to out and there is no need of flushing since there is no buffer to flush.
In this case, the flush=true does not make a difference. An IllegalStateException is not thrown with <jsp:include>, it is only thrown with <jsp:forward> and RequestDispatcher.forward if the buffer is flushed (i.e. response is commited).
This brings up an interesting question the answer to which I don't know. What if the page is buffered (which is the default for JSP pages with buffer size="8kb") and autoFlush="true" ?(which is also the default) In this case what if the buffer is automatically flushed by the container (because the buffer has grown to a size > "8kb") and then a <jsp:forward> or RequestDispatcher.forward is executed? Will this result in an IllegalStateException even though the user has not commited/flushed the response?
Sorry I'm answering your question with another question and making it more confusing.
I would appreciate it if someone would answer this query I have. (BTW, I'm not sure if this kind of question can be on the exam - its really tricky - I hope not)
You showed up just in time for the waffles! And this tiny ad:
Building a Better World in your Backyard by Paul Wheaton and Shawn Klassen-Koop