【问题标题】:p:commandButton's actionListener does not generated ViewExpiredExceptionp:commandButton 的 actionListener 没有产生 ViewExpiredException
【发布时间】:2013-08-16 20:56:26
【问题描述】:

我在页面上有一个 p:commandButton。当会话超时并且我单击它时,没有任何反应。日志上不显示任何内容,并且未调用该操作。

我已阅读 this postthis post 关于该主题的内容。所以我用下面的代码创建了一个 ExceptionHandler:

Throwable exc = null;
for (final Iterator<ExceptionQueuedEvent> it = getUnhandledExceptionQueuedEvents().iterator(); it.hasNext();) {
    exc = it.next().getContext().getException();
}
return exc;

为了获取异常并将用户重定向到错误页面。但是,迭代器总是空的,所以exc总是null...

【问题讨论】:

    标签: jsf primefaces


    【解决方案1】:

    我发现了问题所在。

    实际上,请求被身份验证过滤器拦截。过滤器在会话中找不到用户,因为它已过期,并试图将用户重定向到登录页面。

    由于我的过滤器使用的是HttpServletResponse#sendRedirect,而这在 Ajax 调用上不起作用,因此实际上什么都没有发生。

    This (another) perfect answer by BalusC 为我指明了方向。所以,问题解决了!

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2015-01-22
      • 2014-12-26
      • 1970-01-01
      • 2013-10-22
      • 2016-06-02
      • 2014-09-12
      • 1970-01-01
      • 2013-10-15
      相关资源
      最近更新 更多