`

Cannot forward a response that is already committed

阅读更多
参考资料
1 Cannot forward a response that is already committed
http://blog.csdn.net/quechao123/article/details/6256653
2 Cannot forward after response has been committed转发
http://heisetoufa.iteye.com/blog/227195
3 java.lang.IllegalStateException:Cannot forward after response has been committed
http://www.myexception.cn/java%20exception/1223.html
报错如下:
java.lang.IllegalStateException: Cannot forward a response that is already committed.
java.lang.IllegalStateException: Cannot forward a response that is already committed
at weblogic.servlet.internal.RequestDispatcherImpl.forward(RequestDispatcherImpl.java:97)
at weblogic.servlet.internal.StubSecurityHelper$ServletServiceAction.run(StubSecurityHelper.java:225) Truncated. see log file for complete stacktrace

错误原因:
1.在forwar之前,response就已经commit到浏览器端了。
导致response commit的原因包括:forward, redirect, flushBuffer
2.前两个原因都是指在forward之前就已经进行了页面跳转动作(forward, redirect)。
3 Response.sendRedirect();后没有加return语句.

解决方法
1 增大缓冲区大小:    
<%@ page buffer="10kb" %>

2   加上return null 
servlet.getServletContext().getRequestDispatcher("/DateUpdatePage.do").forward(request, response);  
 return null ;  

总结:其实主要的是程序的问题,仔细检查逻辑是否正确
分享到:
评论
1 楼 枯芦苇 2012-11-14  
servlet.getServletContext().getRequestDispatcher("/DateUpdatePage.do").forward(request, response);

response既然已经commit 在此处再使用response会报空指针异常。

相关推荐

    Cannot forward after response has been committed

    "Cannot forward after response has been committed" 是一个在Java Web开发中常见的错误,通常与Servlet、Filter或控制器逻辑有关。这个错误表明服务器已经完成了对HTTP响应的处理,并将其发送到客户端,然后试图...

    Efficient Proofs that a Committed Number Lies in an Interval.pdf

    对于g∈Z*_n和在其生成的群中的a,logg(a)表示以g为底的a的离散对数,即满足a=g^x mod n的x,其中x属于{-ord(g),...,ord(g)}。 #### 方法概述 ##### 传统方法的问题 - **第一种方法**:虽然能够证明数字属于较小...

    a project model for the FreeBSD Project.7z

    It is with their contributions that the project can move forward. Regular developers are referred to as contributors. As by January 1st, 2003, there are an estimated 5500 contributors on the project....

    微软内部资料-SQL性能优化3

    If a match is found, it knows that resource is already locked. Some of the resources have “sub-resources.” The followings are sub-resources displayed by the sp_lock output: Database Lock Sub-...

    servlet2.4doc

    A filter is an object that performs filtering tasks on either the request to a resource (a servlet or static content), or on the response from a resource, or both. Filters perform filtering in the ...

    微软内部资料-SQL性能优化2

    A reference to an invalid page (a page that is not in your working set) is referred to as a page fault. Assuming the page reference does not result in an access violation, a page fault can be either ...

    HP-dos-AMDbrand.GHO

    HP部分笔记本,重写BIOS或更换主板后,开机提示“WANING!!-Machine is not in committed state!”屏幕出现"主机处于未定义状态"警告。

    Beginning ASP.NET for Visual Studio 2015

    and learn how Microsoft has committed itself to more continuous innovation by increasing its release cadence for all products and services going forward. Coverage includes Async-aware debugging, ADO...

    Git-2.21.0-64-bit.zip

    compute in a way that is compatible with "git patch-id --stable". * The "git log" command by default behaves as if the --mailmap option was given. UI, Workflows & Features * The "git fast-...

    response jsp 中的重要知识点

    `resetBuffer()`可以清空缓冲区,`isCommitted()`检查是否已提交响应。 9. **关闭响应** 一旦响应被提交,就不能更改。但可以通过`reset()`来清除所有设置,使响应回到初始状态。然而,一旦客户端开始接收数据,就...

    HttpWebRequest出错.Section=ResponseHeader Detail=CR

     Section=ResponseHeader Detail=CR 后面必须是 LF The server committed a protocol violation. Section=ResponseHeader Detail=CR must be followed by LF 主体意思是微软没有容忍不符合RFC 822...

    55 Read Committed隔离级别是如何基于ReadView机制实现的?l.pdf

    在探讨数据库事务隔离级别时,Read Committed(简称RC)是一个重要的概念。RC隔离级别意味着,当事务运行期间,如果别的事务对数据进行修改并且提交了,当前事务是可以读取到这些修改后的数据的。然而,这也导致了不...

    google repo工具

    This is achieved by binding pipes to the command's stdin, stdout, and sterr streams, and piping all output into a continuous stream that is displayed in a single pager session. -v: show messages the...

    Paul Ekman - Unmasking The Face. A guide to recognizing emotions from facial clues.part1.rar

    The only complaint I would have is that I had to do a lot of page flipping back and forth to read Ekman's remarks and subsequently refer to the relevant picture. Perhaps a future edition could be ...

    Paul Ekman - Unmasking The Face. A guide to recognizing emotions from facial clues.part2.rar

    The only complaint I would have is that I had to do a lot of page flipping back and forth to read Ekman's remarks and subsequently refer to the relevant picture. Perhaps a future edition could be ...

    Websphere下部署与tomcat程序配置的差异

    Response already committed. 的异常。解决方法是升级到 6.1.0.17 版本。 9. 修改 Websphere 的 JSP 编译 JDK 版本 修改 Websphere 的 JSP 编译 JDK 版本可以解决一些问题。修改方法是,找到发布之后的应用目录,...

    Developer Express XtraGrid Suite All Sources Code

    suite fool you - the XtraGrid Suite, is far more than just a grid control. And even more important, if you are committed to delivering top notch features to your customers and want the most ...

Global site tag (gtag.js) - Google Analytics