img
.
the session scope, which will cause memory consumption issues when there a lot
of concurrent users. When using Spring Web Flow, understanding the scopes of
beans and variables that it maintains is very important. Table 18-1 shows the
available scopes and their purposes.
Table 18-1. Available Bean Scopes in Spring Web Flow
Scope
Purpose
Flow
The variables with flow scope are allocated when the flow starts and are destroyed
when the flow ends. It's the scope to use if you want the variable, which usually stores
the interaction state as well as the underlying model, to be maintained during the
entire flow. A flow scope bean should implement the java.io.Serializable interface.
A flow scope variable is not accessible in its subflows.
View
The variables with view scope are allocated when the flow enters a view (called the
view-state) and destroyed when the state exits. In other words, view scope variables
survive only within a view. When you need to display information (for example, a list
of contacts) that is required only within a certain view within the flow, you should use
the view scope to minimize the memory consumption.
Request
Variables with request scope are created when the flow is called and destroyed when
the flow returns.
Flash
Variables with flash scope are allocated when the flow starts. Then, they will be
cleared after each view is rendered and destroyed when the flow completes. It's useful
for those variables that exist in every view, but the value will be different in each view.
One example is the status message that will be displayed in every step of the flow to
indicate the flow status or display messages to users.
Conversation
The conversation scope is the same as the flow scope. The only difference with flow
scope is that the variables with the conversation scope will be available for its flows.
For example, an order application provides a flow for entering order information.
Within the flow, one step is to invoke a flow called select-customer to select the
customer who places the order. However, in the subflow, when selecting the
customer, the information about the order should be available because it contains
some filter criteria (for example, an international order can be placed only by
customers living in certain countries). For this case, the order should be placed under
the conversation scope.
For a detailed description of Spring Web Flow, please refer to the project documentation site
(http://static.springsource.org/spring-webflow/docs/2.3.x/reference/html/index.html) and the
book Pro Spring MVC with Web Flow (Apress, 2012).
Introducing JSF
JavaServer Faces (JSF) is another popular view technology used for developing the presentation layer of
an enterprise application. Generally speaking, JSF is a request-driven MVC web framework based on a
component-driven UI design model.
Search WWH :
Custom Search
Previous Page
Spring Framework 3 Topic Index
Next Page
Spring Framework 3 Bookmarks
Home