getWriter() has already been called for this response 的解决办法

getWriter() has already been called for this response

response已经被其他对象调用了,导致无法继续使用如下 类似的方法

PrintWriter out = response.getWriter();
out.print("就是不让我使用");
out.flush();
out.close();

郁闷了一个早上,后来翻了几遍API,nnd   直接 这么写就OK了。真晕

response.reset();
PrintWriter out = response.getWriter();
out.print("看你还让不让我使用");
out.flush();
out.close();

不过reset的时候 有可能要response.setContentType(String);一下。

你可能感兴趣的:(getWriter() has already been called for this response 的解决办法)