1200字范文,内容丰富有趣,写作的好帮手!
1200字范文 > java.lang.IllegalStateException: Cannot call sendRedirect() after the response has been commi

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

时间:2018-10-10 09:11:44

相关推荐

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

HTTP Status 500 - Cannot call sendRedirect() after the response has been committed

主要是 sendRedirect()执行完之后没有结束,还会继续往下执行,所以sendReirect()后面就不要在sendReirect()了。

if(type.equals("0")){

...

response.sendRedirect("cart.jsp");}else if(type.equals("1")){

...

response.sendRedirect("cart.jsp");}else if(type.equals("2")){...response.sendRedirect("cart.jsp");}else if(type.equals("3")){...response.sendRedirect("success.jsp");}response.sendRedirect("index.jsp");

要么每次sendRedirect之后return 要么再放个else

本内容不代表本网观点和政治立场,如有侵犯你的权益请联系我们处理。
网友评论
网友评论仅供其表达个人看法,并不表明网站立场。