【问题标题】:What is the use of response.sendRedirect()?response.sendRedirect() 有什么用?
【发布时间】:2010-12-10 07:15:25
【问题描述】:

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

【问题讨论】:

    标签: java jsp redirect response


    【解决方案1】:

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

    【讨论】:

    • 缓冲区大小示例:<%@ page buffer="256kb" autoFlush="false" %>
    • 非常感谢钱德拉先生
    猜你喜欢
    • 1970-01-01
    • 2013-12-20
    • 1970-01-01
    • 2023-03-05
    • 2012-04-18
    • 2015-01-19
    • 2016-01-18
    • 1970-01-01
    相关资源
    最近更新 更多