Expert Spring MVC and Web Flow

(Dana P.) #1
For many problems these existing scopes are sufficient. A page can access the request
scope for data specific to a single request and session scope can be used to hold objects that
are required for the user’s entire session such as authentication information.

The Problem with the Servlet Specification


Many web applications have use cases that do not naturally fit into the scopes provided by the
Servlet specification. These use cases often span more than one page but do not require the
longevity of the session. Users may also perform different use cases per browser session or
even execute the same use case over and over. In this scenario, data associated with one use
case execution needs to be cleaned up before a new execution can begin, which is something
the session cannot do. In essence, the Servlet specification is missing the concept of a
conversationalscope to support the execution of use cases that span multiple pages.

■NoteIn Spring Web Flow, the name for a conversation is flow.We will use the two words interchangeably
throughout the next two chapters.

Figure 11-1 illustrates these different types of interactions.

Figure 11-1.Example use cases and corresponding scopes

Web Page

Add a new user

Web Page Web Page

Request (page)

Conversation/use case

Session

Web Page

Create a report

Web Page Web Page

Web Page

Welcome Page

310 CHAPTER 11 ■INTRODUCTION TO SPRING WEB FLOW

Free download pdf