Because you haven't called flush
.
Everything will be cleared out before forwarding if you haven't flushed. Otherwise, you'll get an excpetion you expect.
As in the docs:
For a RequestDispatcher obtained via getRequestDispatcher(), the ServletRequest object has its path elements and parameters adjusted to match the path of the target resource.
forward should be called before the response has been committed to the client (before response body output has been flushed). If the response already has been committed, this method throws an IllegalStateException. Uncommitted output in the response buffer is automatically cleared before the forward.