日期:2014-05-16  浏览次数:20275 次

jsp页面上 out.flush 报错
报错主要内容:

Internal error flushing the buffer in release()

java.io.IOException: Stream closed

后来查看代码,发现两行代码有点怪,out.flush, out.close

网上一查才知道:

在jsp页面上向页面输出内容直接用out.println输出,此处的out是PrintWriter,PrintWriter是字符直接输出显示出来

而有时候要向页面输出二进制,也就是用outputstream,这种情况一般是下载文件时用到。

所以这里的错就错在:

用out.println("<>")后,多加out.flush和out.close,PrintWrite在jsp页面上输出字符,并不用flush和close,不然会报错。