【问题标题】:Primefaces: dealing with redirection when onbeforeunload is activePrimefaces:在 onbeforeunload 处于活动状态时处理重定向
【发布时间】:2013-09-23 08:58:01
【问题描述】:

我在代码中的很多地方都使用了 JSF 重定向:

FacesContext.getCurrentInstance().getExternalContext().redirect(url);

重定向是作为响应发送的:

<partial-response>
    <redirect url="http://some/url"></redirect>
</partial-response>

问题是,我有激活 onbeforeunload 并且在处理重定向时显示警告消息:

$(window).bind('beforeunload', function(){
    return '${onbeforeunload}';
});

有没有办法插入重定向处理机制并在那个地方停用 onbeforeunload?或者是否有任何 JSF2/PrimeFaces 模式可以以通用方式处理 onbeforeunload?

【问题讨论】:

    标签: jsf-2 primefaces onbeforeunload


    【解决方案1】:

    您可以尝试重写重定向函数PrimeFaces.ajax.ResponseProcessor.doRedirect(a) 以在重定向之前删除 beforeunload 侦听器。 jQuery.unbind

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2010-09-22
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2019-09-16
      • 2012-12-12
      相关资源
      最近更新 更多