Java.lang.IllegalStateException: Cannot call sendRedirect() after the response has been committed(示例
Posted Dylan_G
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了Java.lang.IllegalStateException: Cannot call sendRedirect() after the response has been committed(示例相关的知识,希望对你有一定的参考价值。
在使用response重定向的时候,报以下错误:
Java.lang.IllegalStateException: Cannot call sendRedirect() after the response has been committed
原因如下:
1. response重定向后没有return,后续程序继续运行,遇到了后续的再次重定向代码报错。
解决方法:重定向后return。
2. response重定向后还有重定向 ,重复的重定向
解决办法:去掉其中的一个redirect,或者response
以上是关于Java.lang.IllegalStateException: Cannot call sendRedirect() after the response has been committed(示例的主要内容,如果未能解决你的问题,请参考以下文章