Spring Web Stream - Stream and view pane
Most web applications are content for using servlet-defined request, session, and context areas. However, most of the status data used in the web application does not quite fit into any of these areas. As a rule, such data lasts longer than one request, but shorter than the session. The session area is usually used in this case. This forces the developer to significantly perform manual memory management in order to put things in the session area, and then explicitly delete them when they are no longer needed for this part of the application. This can be frustrating, as there are usually several places where attributes should be removed, as there are often several actions that the user can invoke to get them out of a use case where attributes are needed.
In large or growing applications, attribute clearing code is becoming a necessary and pervasive mess throughout the code. Forgetting to clear attributes or clear error errors, you can enter errors.
SWF solves this by providing additional areas that better match the application attribute life cycle.
SWF introduces the concepts of flows, which are reusable modular groupings of behavior, presented as a state machine, consisting of states and transitions between them. The stream may include action states for invoking server-side behavior, presentation states for displaying pages to the user, and others. Threads often represent use cases. Attributes with stream coverage are stored throughout the stream and are automatically cleared when the stream ends. This results in attributes that are stored only for the duration of use, where they are needed.
ViewStates inside the stream renders the view to the user. Transitions from viewState can move to another state or can remain in the same view, re-displaying the view (with or without AJAX) after performing some actions. Attributes in viewScope are retained while the control remains in viewState. ViewScoped attributes store browser updates and are useful for data that is relevant only to the visualization, such as data that is used in AJAX requests, or for flags that somehow affect markup. When a transition is called that leaves the viewState, the viewScoped attributes are cleared.
Thus, additional areas of SWF are better suited for the application attribute life cycle, and using these additional areas eliminates the need to manually manage your attributes, which reduces the number of authorizing attribute attributes throughout the application and the potential for errors.