注销双击后,“找不到保存的视图状态......”

时间:2016-10-06 11:55:53

标签: primefaces jsf-2 myfaces viewexpiredexception requestscope

我有一个带有注销按钮的应用程序。双击按钮后,我得到一个ViewExpiredException

An unexpected exception was caught during processing the request:
javax.faces.application.ViewExpiredException: /faces/session-timeout.xhtml

我的注销方法具有以下结构:

try {
    destroyBackendSession(); // this logs to be successful
} catch (InvalidArgumentException e) {
    logError(e);
} finally {
    try { 
        FacesContext.getCurrentInstance().getExternalContext().redirect(userBean.getPortalUrl());
    } catch (IOException e) {
        logError(e);
    }
    FacesContext.getCurrentInstance().getExternalContext().invalidateSession();
}

此处未记录任何错误,因此似乎所有内容都按预期工作。

bean是请求作用域。

web.xml的潜在相关配置:

<context-param>
    <!-- Serialization and deserialization of the component tree is a major performance hit.  -->
    <param-name>org.apache.myfaces.SERIALIZE_STATE_IN_SESSION</param-name>
    <param-value>false</param-value>
</context-param>
[...]
<error-page>
    <exception-type>javax.faces.application.ViewExpiredException</exception-type>
    <location>/faces/session-timeout.xhtml</location>
</error-page>

理想情况下,我想在注销后将用户重定向到门户页面,而不是错误页面。 (参见logout() - 上面的方法中的userBean.getPortalUrl()

0 个答案:

没有答案