Managed Bean scopes explained…

Courtesy: NetBeans

Communication between Backing beans

Before you create a bean property to store a value, you must determine the appropriate scope for the property’s value. Because many users can access a web application at the same time, you need to use the smallest scope possible to make the best use of server resources. The following figure illustrates the duration of each type of scope.

* Application scope lasts until the server stops the application. Values that you store in an application bean are available to every session and every request that uses the same application map.
* Session scope begins when a user first accesses a page in the web application and ends when the user’s session times out due to inactivity, or when the web application invalidates the session, such as, for example, by calling session.invalidate().
* Request scope begins when the user submits the page and ends when the response is fully rendered, whatever page that is.

Warning: You cannot use a request bean if you have included the <redirect> element inside the element of a navigation rule. (You see these rules when you click the XML button in the Page Navigation editor.) When the page is submitted, the <redirect> element redirects the page and ends the request before a subsequent page can use any of the values stored in the Request Bean.

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: