In your MAF design, you have defined a ''checkout'' feature based on a task flow where customers place items into their shopping basket and, at the end of task flow, either purchase the items in the shopping cart or cancel the order. The items in the shopping cart are persisted in a managed bean.
Which single bean scope is the right option for the shopping cart managed bean?
Mobile Application Framework variables and managed bean references are defined within different object scopes that determine the variable's lifetime and visibility. MAF supports the following scopes, listed in order of decreasing visibility:
Application scope---The object is available for the duration of the application (across features).
Page flow scope---The object is available for the duration of a feature (single feature boundary).
View scope---The object is available for the duration of the view (single page of a feature).
Object scopes are analogous to global and local variable scopes in programming languages. The wider the scope, the higher the availability of an object. During their lifespan, these objects may expose certain interfaces, hold information, or pass variables and parameters to other objects. For example, a managed bean defined in application scope will be available for use during multiple page requests for the duration of the application. However, a managed bean defined in view scope will be available only for the duration of one page request within a feature.
Currently there are no comments in this discussion, be the first to comment!