" Always remember that the included pages can't do anything to the headers. Be it a servlet or a jsp. "
But why ?? because i did tried one example and it is working fine . i included one jsp which is setting a new header and it is not giving me any problem.
Can someone explain me where i am getting wrong in understanding this statement.
Also one thing i will like to ask you is there anything specified in the specs which says that
"Even if you dont flush the response,you should not write anything in the response or set headers or cookies incase if you gonna do a forward"
Anything like this ? i know that you said earlier that for practical purposes you shouldnt do this but i want to what is specified regarding this matter in the specs,since the exam is all about what specs says
Even if you dont flush the response,you should not write anything in the response or set headers or cookies incase if you gonna do a forward"
Anything like this ? i
This is written about it:
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. 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. 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.
the phrase "the content must be cleared ..." is what the container should do. Everything that was written to the response (before the forward) is therefore lost.