The include method defined in the RequestDispatcher class can be used to access one servlet from another. But it can be invoked only if no output has been sent to the server.
Is it ture of false? The forward() method must be called before the respose is committed. Is it also ture for include() method?
1) The forward method must be called before the response is committed since it forwards the current request to the next resource for processing. If the response has already been commited the request is no longer valid and an Illegal State Exception is thrown.
2) The include method can be called whenever since the request is not forwarded permanently. It is passed to the next resource temporarily for processing purposes, but any changes to the headers or status codes of the request by the called resource are ignored.
This is from page 56 Table 4.12 of Deshmukh / Malavia
- Eric