关于 getWriter() has already been called for this response 的错误解决办法

时间:2023-07-27 20:43:38

java.lang.IllegalStateException: getWriter() has already been called for this response

今天在做显示图片的时候,(用流从数据库读出来显示)遇到了这个错误,

java.lang.IllegalStateException: getWriter() has already been called for this response

使用了PrintWriter out = response.getWriter();

再次使用了ServletOutputStream out = response.getOutputStream();

可以在前面写一个response.reset(); 就没事了