我有一个会话范围的 Bean:
@SessionScoped
public class UserSession {
User user;
}
在我的 LoginView 期间,我抛出了一个 SecurityException:
throw new java.lang.SecurityException("You need to login!");
哪个将被重定向web.xml
到SelectUserBean
现在这是我真的不明白的奇怪事情:在我扔之前SecurityException
,UserSession
有 idUserSession@123456
和 user Foo
。现在在SelectUserBean
有UserSession
一个新的 id 和用户是null
.
在我faces-config
的 Primefaces 异常处理中:
<el-resolver>
org.primefaces.application.exceptionhandler.PrimeExceptionHandlerELResolver
</el-resolver>
和
<factory>
<exception-handler-factory>
org.primefaces.application.exceptionhandler.PrimeExceptionHandlerFactory
</exception-handler-factory>
</factory>
删除后,它按预期工作。对此有什么想法吗?
为什么会这样?我想既然它是一个 SessionScoped bean,它必须是相同的值。