天天看点

重定向异常: Cannot call sendRedirect() after the response has been committed

异常:threw exception [Request processing failed; nested exception is java.lang.IllegalStateException: Cannot call sendRedirect() after the response has been committed] with root cause

java.lang.IllegalStateException: Cannot call sendRedirect() after the response has been committed

重定向异常: Cannot call sendRedirect() after the response has been committed

原因:

response重定向后没有return,后续程序继续运行,重新提交了请求,所以报错,

当根据条件,进行转发或者重定向时对应转发或者重定向语句后面紧跟return;或者return null;