I have a Session Scoped Bean:
@SessionScoped
public class UserSession {
User user;
}
During my LoginView, I throw a SecurityException:
throw new java.lang.SecurityException("You need to login!");
Which will be redirected by the web.xml
to SelectUserBean
Now here is the strange thing which I really do not understand: Before I throw the SecurityException
, the UserSession
has id UserSession@123456
and user Foo
. Now in the SelectUserBean
the UserSession
has a new id and the user is null
.
in my faces-config
I had Primefaces exception handling:
<el-resolver>
org.primefaces.application.exceptionhandler.PrimeExceptionHandlerELResolver
</el-resolver>
and
<factory>
<exception-handler-factory>
org.primefaces.application.exceptionhandler.PrimeExceptionHandlerFactory
</exception-handler-factory>
</factory>
after removing, it works as expected. any ideas on this?
Why does this happen? I thought since it is a SessionScoped bean it must be the same value.