Hayi
Hayi

Reputation: 6236

@SessionScoped for each user

I have many managed beans with :

@ManagedBean 
@SessionScoped

And when a user get login at my web application it works normally but the problem when a second user get login he use the managed beans of the previous user.

So i want that each user have their own managed beans even many users get login at the same time.

Upvotes: 1

Views: 333

Answers (1)

BalusC
BalusC

Reputation: 1108722

That can happen if you test the logins in the same browser instance. The session is namely tied to a single browser instance and thus all opened windows/tabs of the same browser instance share the same session. To properly test multiple users, you'd better test using different browser instances, e.g. one user in Chrome and another user in Firefox. Alternatively, you can also open a new "incognito" window in Chrome by Ctrl+Shift+N. This will use a separate space for sessions/cookies/history which is not stored after you close the instance.

Upvotes: 2

Related Questions