版权声明:本文为博主原创文章,未经博主允许不得转载。 https://blog.csdn.net/xing930408/article/details/86596180
如题,在加入过滤器后,发现response.getOutputStream().write("hhhhhhhhhhhhhhhh".getBytes("UTF-8"));无效,拿到的返回都是正常的业务返回,检查了很多变,发现自己蠢哭了。。。
在继承的HttpServlet类,doPost方法处理完成后,response.getOutputStream().write();随后又加了resp.getOutputStream().close();导致流关闭,再进行response.getOutputStream().write时任何值都写不进去
resp.getOutputStream().write("hhhhhhhhhhhhhhhh".getBytes("UTF-8")); resp.getOutputStream().flush(); resp.getOutputStream().close(); resp.getOutputStream().write("dddddddddd".getBytes("UTF-8")); resp.getOutputStream().flush();