That is because of buffering. If the first print call would not be buffered, the code will throw IllegalStateException. That is what is assumed in the question.

About RequestDispatcher.forward(): 1) Response must not be committed before call else IllegalStateException. 2) Any data written to response object after call is simply ignored.

BS<br />SCJP 1.4 88%<br />SCWCD 1.4 86%

janne s

Ranch Hand

Posts: 81

posted 11 years ago

HI!

is this stmt correct:

RequestDispatcher.forward() is also a normal method call, so the control does return to the calling resource.

siva raju

Ranch Hand

Posts: 37

posted 11 years ago

Yes, control returns to the calling resource like in any method. Only, you can't access the output stream. If you insert <jsp:forward...> in a jsp, then in the translated servlet, the container might insert a 'return' statement immediately after the rd.forward() call.