1.response.getWriter().print("");2.PrintWriterout=response.getWriter();out.print("");out.close();第一种方式可以吗?流会自动关闭吗?
2 回答
慕森卡
TA贡献1806条经验 获得超8个赞
response.getWriter().print("");不会自动关闭response.getWriter源码publicPrintWritergetWriter()/**/throwsIOException/**/{/*213*/PrintWriterwriter=this.response.getWriter();/*214*/if(isFinished()){/*215*/this.response.setSuspended(true);/**/}/*217*/returnwriter;/**/}print方法源码publicvoidprint(Strings){if(s==null){s="null";}write(s);}
添加回答
举报
0/150
提交
取消