关于Cannot call sendRedirect() after the response has been committed的解决办法

待我称王封你为后i 2022-05-15 03:16 687阅读 0赞

在servlet重定向的时候遇到这个错误:
Java.lang.IllegalStateException: Cannot call sendRedirect() after the response has been committed
这里写图片描述
原因如下:
1.response重定向后没有return,后续程序继续运行,遇到了后续的再次重定向代码报错。
2.response重定向前关闭了流,导致问题出现
【-_-||】
这里写图片描述

发表评论

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

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

相关阅读