How to clear the screen output of Java httpservletresponse
I'm using servletresponse getWriter(). Write (string) writes to the browser window
But how do I clear text previously written by other similar write calls?
Solution
The short answer is, you can't - once the browser receives a response, there's no way to retract it (unless there is some way to stop the HTTP response abnormally to make the client reload the page, or something to some extent.)
In a sense, the last place where a response can be "cleared" is using servletresponse Reset method, which will reset the buffer of servlet response according to servlet specification
However, this method also seems to have a problem, because it is only effective when the buffer has not been submitted (i.e. sent to the client) through the flush method of ServletOutputStream