posted 12 years ago
when you 'forward' or 'include', the same request and response is passed to that resource. If you close the output stream, it cannot be used by the JSP to return the data. As soon as any data gets written to the client, the response is 'committed', and if you check the API, closing the Writer also flushes it (ie sends the data). Since you set the content type first it also ensures that there is data to be sent.