When flush() is executed, then all what was in buffer is sended to the browser and buffer is cleared.
So, all that is sended with response.getWritter().print("..."); is going to the browser, but first it is in the buffer. When buffer is flushed, things which were in the buffer are being sended to the browser. That's how 'a' gets printed out int he browser, it was sended, becouse the buffer was flushed. So buffer was flushed, it was sended, and in the next line, the statment which gets executed request.getRequestDispatcher("/index.html").forward(request, response); would normally (as I remember) throw an exception and it would be send to the browser, but by that moment the page was allready gone away together with the flush, thats why the exception that would otherwise end on the screen ends nowhere (i think nowhere)... But still, this thing:
That should get printed on the Tomcat's log output (i suppose I can call it log output), anyway in Tomcat's window this error should be observable, as it appears, or, if You work in an Eclipse, in the console widow of the Eclipse (the window down, south..)..
I hope I didn't confused You..
With flush() the page was sent... ( I am not one hundart percent sure, but I think so)
And the error screen that is supposed to be send, ands somewhere in emptiness (if I may say so)...
(But is it possible to send any text else after the flush() and to get it on the screen? )
(the error is not sent to your jsp)
Frits Walraven meant on that "error page"... i suppose (that didn't ended on the screen becaouse the outputput was allready flushed)
I appologize if I was terriblly wrong. I just wanted to slove one question before I g to sleep.
Creator of Enthuware JWS+ V6