`
asdzheng
  • 浏览: 95150 次
  • 性别: Icon_minigender_1
社区版块
存档分类
最新评论

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,不然会报错。


分享到:
评论

相关推荐

    网上书城 购物系统 jsp

    out.flush(); out.close(); } /** * The doPost method of the servlet. * * This method is called when a form has its tag value method equals to post. * * @param request the request...

    通过Response.Flush()实现下载失败的解决方法

    Response.Flush()实现对服务端文件的下载时,会失败,不能正常弹出IE下载框,通过测试发现时浏览器的安全设置问题,如下操作便可解决

    hibernate的flush()、refresh()、clear()针对一级缓存的操作的区别.docx

    session.flush()和session.clear()就针对session的一级缓存的处理。 简单的说, 1 session.flush()的作用就是将session的缓存中的数据与数据库同步。 2 session.clear()的作用就是清除session中的缓存数据(不管缓存...

    asp Response.flush 实时显示进度

    如果你知道Response.Flush和Response.Clear,那你就可以不用这样的等待了。每生成一个Html页面,就用Response.write立即返回一条信息,提示该条数据库记录已经生成Html。

    简单的登录验证

    简单的JavaEE登录验证,JSP与servlet编程实现:public void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { ... out.flush(); out.close(); }

    Response.Flush的使用心得

    很多时候我们写的asp程序会因为做很多操作,所以会花上一分钟甚至几分钟时间。为了使软件使用者能够耐心的等待程序的执行,我们经常会希望有一个进度条来表示程序执行的状态。或者最起码要显示一个类似: “数据...

    jsp小技巧.rar_flush_jsp s

    如何混合使用Jsp和SSI #include? 在JSP中可以使用如下方式包含纯HTML: &lt;!--#include file="data.inc"--&gt; 但是如果data.inc中包含JSP CODE ,我们可以使用: &lt;%@include file="data.inc"%&gt; 如何执行一个...

    JavaWeb开发技术-JSP动作元素.pptx

    JSP动作元素 Java Servlet Jsp XML ...JAVA WEB开发技术 JSP动作元素 语法 描述 jsp:include ...&lt;jsp:include page="relativeURL" flush="true|false" /&gt; 指定被引入资源的相对路径 指定是否将当前页面的输

    hibernate的session.flush

    博文链接:https://llying.iteye.com/blog/221702

    医院管理系统.rar

    ackage hospital; import java.io.IOException; import java.io.PrintWriter; import java.util.Date; import javax.servlet.... out.flush(); out.close(); } /** * The doPost method of the servlet.

    数据库的基本操作前端加后端.zip

    out.flush(); out.close(); } private void queryAll(HttpServletResponse resp) throws IOException { resp.setContentType("text/html"); resp.setCharacterEncoding("utf-8"); String json=null; try { ...

    handleStream ServletOutputStream out = response.getOutputStream(); InputStream i

    NULL 博文链接:https://nethub2.iteye.com/blog/2023937

    hibernate的flush机制

    对hibernate的flush机制有兴趣可以看看

    网上购物系统

    out.flush(); out.close(); } /** * The doPost method of the servlet. * * This method is called when a form has its tag value method equals to post. * * @param request the request send ...

    socket应用小程序

    dout.flush(); if(str.trim().equals("BYE")) break; } din.close(); dout.close(); socket.close(); }catch(IOException e){ System.out.println("Error: " + e); } } }

    服务器下载文件

    String file_unique = request.getParameter("file_unique"); String date = file_unique.substring(0,7); path = date+"/"+file_unique; System.out.println("--下载路径-... toClient.flush(); toClient.close();

    基于JAVa的网上商城项目完整源码.zip

    out.flush(); out.close(); } /** * The doPost method of the servlet. * * This method is called when a form has its tag value method equals to post. * * @param request the request...

    jsp跳转的五种方式

    事实上现在的server都有cache机制,一般在8K(我是说 JSP SERVER),这就意味着,除非你关闭了cache,或者你使用了out.flush()强制刷新,那么在使用sendRedirect之前,有少量的HTML输出也是允许的。  (2) ...

Global site tag (gtag.js) - Google Analytics