response.sendRedirect java.lang.IllegalStateException
来源:互联网 发布:用网络机顶盒怎么看电视直播 编辑:程序博客网 时间:2024/06/03 19:38
类文件中调用 response.sendRedirect(cururl);
发生了如下错误:
[07-9-11 16:09:47:106 CST] 3c5a6abb WebGroup E SRVE0026E: [Servlet 错误]-[]:java.lang.IllegalStateException
at com.ibm.ws.webcontainer.srt.SRTServletResponseContext.sendRedirectWithStatusCode(SRTServletResponseContext.java:118)
at com.ibm.ws.webcontainer.srt.SRTServletResponseContext.sendRedirect(SRTServletResponseContext.java:76)
at com.ibm.ws.webcontainer.srt.SRTServletResponse.sendRedirect(SRTServletResponse.java:758)
解决方法:
response.sendRedirect的注意事项
1,在使用response.sendRedirect时,前面不能有HTML输出。
这并不是绝对的,不能有HTML输出其实是指不能有HTML被送到了浏览器。事实上现在的server都有cache机制,一般在8K(我是说JSP SERVER),这就意味着,除非你关闭了cache,或者你使用了out.flush()强制刷新,那么在使用sendRedirect之前,有少量的HTML输出也是允许的。
如果报错说,“一些信息已经被submitted”(原文忘了),那么,你就要注意看了,前面是不是有过多的HTML输出了。
2,在response.sendRedirect之后,应该紧跟一句return;
我们已经知道response.sendRedirect是通过浏览器来做转向的,所以只有在页面处理完成后,才会有实际的动作。既然你已经要做转向了,那么后的输出还有什么意义呢?而且有可能会因为后面的输出导致转向失败。
结论:在response.sendRedirect之后,应该紧跟一句return
- response.sendRedirect java.lang.IllegalStateException
- response.sendRedirect java.lang.IllegalStateException
- Cannot set header. Response already committed及response.sendRedirect报java.lang.IllegalStateException的一次解决
- java.lang.IllegalStateException: Cannot call sendRedirect() after the response has been committed
- 解决struts/spring偶尔出现java.lang.IllegalStateException: Cannot call sendRedirect() after the response的问题
- java.lang.IllegalStateException: Cannot call sendRedirect() after the response has been committed
- java.lang.IllegalStateException: Cannot call sendRedirect() after the response has been commi
- java.lang.IllegalStateException: Cannot call sendRedirect() after the response has been committed
- Java.lang.IllegalStateException: Cannot call sendRedirect() after the response has been committed
- java.lang.IllegalStateException: Cannot forward after response has been committed
- java.lang.IllegalStateException: Response has already been committed
- java.lang.IllegalStateException: Cannot forward after response has been committed
- java.lang.IllegalStateException: Cannot forward after response has been committed
- Java.lang.IllegalStateException: Cannot forward after response has been committed
- java.lang.IllegalStateException: Cannot forward after response has been committed
- java.lang.IllegalStateException: Cannot forward after response has been committed
- java.lang.IllegalStateException: Cannot forward after response has been committed
- java.lang.IllegalStateException: Cannot forward after response has been committed
- VC++中的消息处理
- 终于能上CSND了,发个文章庆祝一下
- 可以把百度空间里面css源代码解析出来的一网站,想下图片就下图片,乡下按钮就下按钮,哈哈哈
- 使用 Script 方法在一个页面中调用另一个页的方法
- VISUALSTUDIO2003,2005 button_click button_click_1
- response.sendRedirect java.lang.IllegalStateException
- java中自定义标签的配置
- asp比较灵活的在线问答的示例
- 在将要离开公司的日子
- 重叠IO技术在服务器端的应用
- 辛苦的学习C++/VC
- 关于iis一些基本操作
- asp中导出Excel的方法
- 实验博客