So far I know that after we using methods like: HttpServletResponse.sendRedirect, HttpServletResponse.sendError, the response should be considered to be committed and should not be written to. But is this concept also applicable for RequestDispatcher.forward? I am curious about this.
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.
I just read this somewhere ....Please confirm this is correct.
When the sendError() method is called, the response is assumed to be committed. As per the API of the sendError() method, if you write to the response after calling sendError() then the data is ignored and no exception is thrown