Cannot call sendRedirect() after the response has been committed

约定不等于承诺〃 2022-06-18 09:46 234阅读 0赞

Cannot call sendRedirect() after the response has been committed

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

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

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

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

发表评论

表情:
评论列表 (有 0 条评论,234人围观)

还没有评论,来说两句吧...

相关阅读