zoukankan      html  css  js  c++  java
  • JSP解决:Attempt to clear a buffer that's already been flushed错误(jsp:forward标签跳转空白)


    [摘要:本日正在开辟过程当中发明一个题目:正在页里中应用了jsp:forward扔错Attempt to clear a buffer that's already been flushed!! 百思没有得其解!! 谷歌之,得以下说明: 通例,先上中文论坛搜刮谜底 h]


    今天在开发过程中发现一个问题:在页面中使用了<jsp:forward>抛错Attempt to clear a buffer that's already been flushed!!

    百思不得其解!!

    google之,得如下解释:

    惯例,先上外文论坛搜索答案

    http://www.coderanch.com/t/484489/JSP/java/JSP-working

    其中有一句话,解释了这个问题的发生:

    When you forward a request to another resource.. whose response is already commited.. then it throws this exception.
    A request that is being forwarded should not have commited.

    In your case, when the JSP is being executed, it might have generated some html content before it is forwarding.

    If the server has send these html content to a client before you forward the request to another resource, then it throws an illegal state exception if you try to forward.

    As you increased the buffer size, then the server is not actually sending the generated html content to client (Till the buffer fills up).. and on forward the buffer will be cleared.

       意思大致是:当你通过forward请求另一个资源的时候,如果你的服务器已经向client响应了数据,就是所你原来未跳转之前的页面已经存在数据了(我的页面情况是:forward前面通过连接数据库查询到数据赋值给了select下拉列表了),所以就会报错,而设大缓冲区的话,服务器就不会立即响应给服务端,而是等所有页面加载完成之后,或者缓冲区满了之后才会发送响应给用户,

      我的解决办法,在jsp开头加入缓冲区设置语句

    1 <%@ page autoFlush="true" buffer="1094kb"%>

    buffer大小视实际情况来定。。

    原文出处(http://www.ithao123.cn/content-100640.html)

  • 相关阅读:
    Ubuntu 截图工具Flameshot
    django 执行原生的sql
    tensorflow学习笔记(3)前置数学知识
    tensorflow学习笔记(2)-反向传播
    tensorflow学习笔记(1)-基本语法和前向传播
    深度学习-tensorflow学习笔记(1)-MNIST手写字体识别预备知识
    数据结构-查找-散列表的线性探测已经拉链法的查找
    数据结构-查找-折半查找-二叉排序树查找
    数据结构-查找-线性表查找技术
    数据结构-排序-直接插入排序
  • 原文地址:https://www.cnblogs.com/lianghaijie-ctw/p/6148165.html
Copyright © 2011-2022 走看看