Cannot call sendRedirect() after the response has been committed

AJAX+JSP时,out.write('content')之后,如果后面还有代码,无法被执行到,会报 错,java.lang.IllegalStateException: Cannot call sendRedirect() after the response has been committed。

可以在out.write('content');这句代码后面加:return;令下面的代码sendRedirect不再执行。后台就不会报错了

原文地址:https://www.cnblogs.com/wujixing/p/5786289.html