yogen,
First of all: Don't get mad...
Here is what the spec says: (Java Servlet Spec, v2.3)
"SRV.8.4 The Forward Method
The forward method of the RequestDispatcher interface may be called by the
calling servlet only when no output has been committed to the client." This means that if you have committed any output to the client (e.g. by way of an out.flush()) then the servlet container won't let you invoke forward()...
"... If output data exists in the response buffer that has not been committed, the content must be cleared before the target servlet’s service method is called." This means that the servlet container will clear any uncommitted data in the buffer when you invoke forward() and before the request reaches the target servlet.
"... If the response has been committed, an IllegalStateException must be thrown.
[...]
Before the forward method of the RequestDispatcher interface returns, the response content must be sent and committed, and closed by the servlet container." This means that the servlet container ensures that the response has been committed before it returns.
One thing that confuses people is what happens after the forward() method return. Well, remember that this is still good ol' Java language. The statements (if any) following forward() _have_ to be executed. If e.g. you have a logging statement after forward(), (say)
then it will get print to your standard output just fine.
So, the answer to your first question is [true]
[ June 20, 2003: Message edited by: Panagiotis Varlagas ]