But in the Java� Servlet Specification Version 2.4, section SRV 5.3, we have:
If data has been written to the response buffer, but not returned to the client (i.e. the response is not committed), the data in the response buffer must be cleared and replaced with the data set by these methods. If the response is committed, these methods must throw an IllegalStateException.
Even I have doubt on this answer. Actually discussions in the chapter gives clear impression that only flush will cause this exception, But I am not sure why in the answer for this question they included write.