response.sendRedirect()有什么用?

发布于 2024-10-06 23:19:52 字数 157 浏览 0 评论 0原文

使用 respone.sendRedirect("page.jsp") 时,它显示 java.lang.IllegalStateException,而在某些页面中它执行正常。我怎样才能避免这个异常?有关更多详细信息,我昨天通过了一个与此类似的问题。

while using respone.sendRedirect("page.jsp") it was showing java.lang.IllegalStateException, while in some pages it was executing properly. How can I avoid this exception? For more details I passed yesterday a question that was simillar to this.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

爱本泡沫多脆弱 2024-10-13 23:19:52

如果您的响应已提交,respone.sendRedirect 将抛出 java.lang.IllegalStateException。您要么手动刷新缓冲区,要么因为缓冲区已满而自动刷新。为了避免这种情况,请增加缓冲区大小并确保不会刷新它,或者尽早调用 respone.sendRedirect

respone.sendRedirect will throw java.lang.IllegalStateException if your response is already committed. You have either manually flush the buffer or it was automatically flushed because it was full. To avoid this, either increase the buffer size and make sure that you are not flushing it or call respone.sendRedirect early.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文