It represents the scope (the lifetime) of the bean. A request scoped bean lives as long as a single HTTP request-response cycle. A view scoped bean lives as long as you're interacting with the same JSF view by postbacks returning null
/void
. A session scoped bean lives as long as the established HTTP session. An application scoped bean lives as long as the web application runs.
Which scope to choose depends solely on the data (the state) the bean holds and represents. Use the request scope for simple and non-ajax forms/presentations. Use the view scope for rich ajax-enabled dynamic views (ajaxbased validation, rendering, etc). Use the session scope for client specific data, such as the logged-in user and user preferences (language, etc). Use the application scope for application wide data/constants, such as dropdown lists which are the same for everyone.
Abusing an application scoped bean for session/view/request scoped data would make it to be shared among all users, so anyone else can see each other's data which is just plain wrong. Abusing a session scoped bean for view/request scoped data would make it to be shared among all tabs/windows in a single browser session, so the enduser may experience inconsitenties when interacting with every view after switching between tabs which is bad for user experience. Abusing a request scoped bean for view scoped data would make view scoped data to be reinitialized to default on every single (ajax) postback, causing possibly non-working forms (
see also points 4 and 5 here). Abusing a view scoped bean for request scoped data doesn't affect the client, but it unnecessarily occupies server memory.
Note that the scope should rather not be chosen based on performance implications, unless you reallyhave a low memory footprint and want to go completely stateless; you'd need to use exclusively request scoped beans and fiddle with request parameters to maintain the client's state.
See also: