Cannot call sendRedirect() after the response has been committed

来源:互联网 发布:康德…知乎 编辑:程序博客网 时间:2024/05/21 20:24

 Cannot call sendRedirect() after the response has been committed

如果response已经提交过了,就无法再发送sendRedirect了。

所以,在进行:  resp.sendRedirect()之前,必须先保证没有任何的输出,包括:

1、Cookie;
2、resp.getWriter()写文本信息;
3、已经发送过重定向。

重点检查下这些问题,如果你写了Filter,或者Servlet已经做过forward,也要注意看看。

2 0
原创粉丝点击