jQuery in Action, 3rd edition
The moose likes JSF and the fly likes Scopes Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » JSF
Bookmark "Scopes" Watch "Scopes" New topic


Jesus Schneider

Joined: Oct 17, 2012
Posts: 28
I'm new with JSF and I have what I think is a very basic question:
Let's say we have a web page made with JSF with a basic login system. That page has a bean with (let's say) application scope to keep the data of that user during his access to that page.
When a user logs inside that page: is an instance of that bean created for each user or that bean is created just once and shared between all users (depending of the scope)?
In other words: Do I need to adapt that bean to manage ALL users data or each user will have it's own bean with just his data?
Tim Holloway
Saloon Keeper

Joined: Jun 25, 2001
Posts: 17417

Well, first of all, "basic login" sounds like User-Designed Login, which translates to "Hacked". There is a built-in login system that's part of the J2EE standard that I recommend (rather vocally) over writing your own.

Beyond that, however, "application scope" means that the object is shared between every user in the application. What you are looking for is "session scope", where each user has a separate copy of the object.

An IDE is no substitute for an Intelligent Developer.
I agree. Here's the link: http://aspose.com/file-tools
subject: Scopes
It's not a secret anymore!