Spring Web Flow is a next generation Java web application controller framework that allows developers to model user actions as high-level modules called flows that are runnable in any environment. The framework delivers improved productivity and testability while providing a strong solution to enforcing navigation rules and managing application state.
The Big Picture
Spring Web Flow allows developers to build reusable, self-contained controller modules called flows. A flow defines a user dialog that responds to user events to drive the execution of application code to complete a business goal. Consider this graphical view of a flow definition that carries out a search process with the user:
Flows such as the one above are defined declaratively using a rich domain-specific language (DSL). The XML (XSD) form of this language is the most popular with users. Once defined, a flow is testable in isolation, may be embedded within other flows as a subflow, and may be deployed for execution across multiple environments including Java EE Servlet and Portlet (JSR 168) without change.
Spring Web Flow contains a number of innovative features that are popular with our users. These include the ability to:
- Define all controller logic for an application task, such as a search process, in one place, instead of scattering that logic across many places.
- Compose flows together to create rich controller modules from simple parts.
- Enforce strict user navigation rules with a natural, object-oriented linear programming model and without coding verbose if/else blocks.
- Have memory you allocate during flow execution automatically clean itself up when execution ends or expires.
- Deploy a flow for execution in a Servlet environment using your base web framework of choice. Spring Web Flow ships convenient integration with leading web frameworks Struts, Spring MVC, and Java Server Faces.
- Change Web frameworks, going from Struts to Spring MVC for example, without changing your flow definitions.
- Change environments all together, going from JUnit test to Portlet for example, without changing your flow definitions.
- Evolve your application’s navigation rules on-the-fly at development time without a container restart.
- Receive automatic browser button support (back, forward, refresh) with no custom coding.
- Store task data in any of four managed scopes: request, flash, flow, and conversation; each with their own distinct semantics.
- Test flows in isolation without the container. Ensure your application control logic works before you deploy.
- Visualize and edit your flow navigation logic graphically with Spring IDE 2.0.
The best way to get started with Spring Web Flow is read Erwin’s practical introduction and to walk through the sample applications. We recommend reviewing all samples, supplementing with reference manual material as needed from the start. Ten sample applications ship with the release, each demonstrating a distinct set of features. The samples are:
- Phonebook - the original sample demonstrating most features (including subflows)
- Sellitem - demonstrates a wizard with conditional transitions, flow execution redirects, custom text field formatting, and continuations
- Flowlauncher - demonstrates all the possible ways to launch and resume flows
- Itemlist - demonstrates REST-style URLs and inline flows
- Shippingrate - demonstrates Spring Web Flow together with Ajax technology
- NumberGuess - demonstrates stateful beans, evaluate actions, and "single key" flow execution redirects.
- Birthdate - demonstrates Struts integration
- Fileupload - demonstrates multipart file upload, set actions, and flash scope
- Phonebook-Portlet - the phonebook sample in a Portlet environment (notice how the flow definitions do not change)
- Sellitem-JSF - the sellitem sample in a JSF environment
- Booking-Faces - a more comprehensive Spring Web Flow + JSF application.
All sample projects are Spring IDE projects directly importable into Eclipse as "Dynamic Web Projects" that can also be deployed inside the Eclipse IDE with Eclipse Web Tools.
For in-depth and thorough coverage of the entire Spring Web Flow feature set, your best bet is to read Working with Spring Web Flow.
Current Release Notes
- Spring Web Flow 1.0.x is proven software fit for production use.
- Spring Web Flow runs on Java SE 1.3 or greater, and Java EE 1.3 (Servlet 2.3, Portlet 1.0) or greater. Spring Web Flow runs on all major application server platforms.
- Spring 1.2.7 or greater is required for the Spring 1.x series, Spring 2.0 or > is required for the Spring 2.x series.
- Struts Classic (1.2.9), Spring MVC, and JSF integration is shipped out-of-the-box.
- The 1.0 release signifies that public API and XSD backwards compatability will be preserved throughout the 1.x series.
Upcoming Release Notes
- Spring Web Flow 2.0 is the next major release of the framework, focusing on enhanced integration and ease-of-use.
- Spring Web Flow 2.0 final is due out in April of 2008.
- Join our forums for lively discussions about Spring Web Flow usage and architecture. This is the best way to get involved in the Web Flow community.
- Submit bug reports, enhancement requests, and patches using our JIRA issue tracking system.
- Access our SVN source code repository to follow along with Spring Web Flow development.
- Try out the latest features by downloading a nightly build.