Friday, February 3, 2012

JSF 2.0 Scopes - What is scope

scope

A dictionary data structure into which managed beans are stored.

scope name

The name of a data structure into which are stored
managed beans that declare they belong in that scope.

for example, request, session, application, view,
#{controller.foo}, #{store.bar}, #{manager.baz} etc.

scope lifetime

The amount of time managed beans that are stored in a scope
are considered valid and are guaranteed not to be garbage
collected.

With any of the named scopes (request, session, etc) the scope lifetime
is predefined by the specification.

With a custom scope, you, the developer, are telling the framework
"evaluate the expression #{store.foo}" and treat the result as a Map.
Therefore, the logic in the managed bean can control the lifetime. Like
this:

@ManagedBean
public class Store {
public Map getFoo() {
// Determine if I need to create a new map, if so, create it.
// return the Map; Perhaps an inner class is useful.
}
}

Because the Store class is called whenever a managed bean needs to be
obtained or stored, the Map it returns can call clear() on itself
whenever it needs to.

2 comments:

Actor Vijay said...

The big comprehensive wide range places and also the experts of the expert arms and the development in the technological innovation. The assistance organization and also the topmost moving procedure in this particular position.

Provided by-

http://top3rd.in/packers-and-movers-gurgaon/

http://top3rd.in/packers-and-movers-pune/

http://top3rd.in/

Actor Vijay said...

The skilful people and also the different places and also you go ahead for the different moving.
Visit view more information-


http://top3rd.in/packers-and-movers-mumbai/

http://top3rd.in/packers-and-movers-bangalore/

http://top3rd.in/