# Preface

Many web applications require the same sequence of steps to execute in different contexts. Often these sequences are merely components of a larger task the user is trying to accomplish. Such a reusable sequence is called a flow.

Consider a typical shopping cart application. User registration, login, and cart checkout are all examples of flows that can be invoked from several places in this type of application.

Spring Web Flow is the module of Spring for implementing flows. The Web Flow engine plugs into the Spring Web MVC platform and provides declarative flow definition language. This reference guide shows you how to use and extend Spring Web Flow.

# Introduction

## What this guide covers

This guide covers all aspects of Spring Web Flow. It covers implementing flows in end-user applications and working with the feature set. It also covers extending the framework and the overall architectural model.

## What Web Flow requires to run

Java 1.4 or higher

Spring 2.5.6 or higher

## Where to get support

Professional from-the-source support on Spring Web Flow is available from SpringSource, the company behind Spring, and Ervacon, operated by Web Flow project co-founder Erwin Vervaet

## Where to follow development

You can help make Web Flow best serve the needs of the Spring community by interacting with developers at the Spring Community Forums.

Report bugs and influence the Web Flow project roadmap using the Spring Issue Tracker.

Subscribe to the Spring Community Portal for the latest Spring news and announcements.

Visit the Web Flow Project Home for more resources on the project.

## How to access Web Flow artifacts from Maven Central

Each jar in the Web Flow distribution is available in the Maven Central Repository. This allows you to easily integrate Web Flow into your application if you are already using Maven as the build system for your web development project.

To access Web Flow jars from Maven Central, declare the following dependencies in your pom:

    <dependency>
        <groupId>org.springframework.webflow</groupId>
        <artifactId>spring-binding</artifactId>
        <version>2.0.9.RELEASE</version>
    </dependency>

    <dependency>
        <groupId>org.springframework.webflow</groupId>
        <artifactId>spring-js</artifactId>
        <version>2.0.9.RELEASE</version>
    </dependency>

    <dependency>
        <groupId>org.springframework.webflow</groupId>
        <artifactId>spring-webflow</artifactId>
        <version>2.0.9.RELEASE</version>
    </dependency>

And if using JavaServerFaces:

    <dependency>
        <groupId>org.springframework.webflow</groupId>
        <artifactId>spring-faces</artifactId>
        <version>2.0.9.RELEASE</version>
    </dependency>

## How to access Web Flow artifacts from the SpringSource Bundle Repository

Each jar in the Web Flow distribution is also available in the SpringSource Enterprise Bundle Repository. Use this repository when you wish to run Spring Web Flow in an OSGi environment such as the SpringSource dm Server. All jars obtained from the SpringSource Bundle Repository are OSGi-ready.

### Accessing Web Flow bundles with Maven

To access bundles using Maven, add the following repositories to your Maven pom:

    <repository>
        <id>com.springsource.repository.bundles.release</id>
        <name>SpringSource Enterprise Bundle Repository - SpringSource Releases</name>
        <url>http://repository.springsource.com/maven/bundles/release</url>
    </repository>

    <repository>
        <id>com.springsource.repository.bundles.external</id>
        <name>SpringSource Enterprise Bundle Repository - External Releases</name>
        <url>http://repository.springsource.com/maven/bundles/external</url>
    </repository>

Then declare the following dependencies:

    <dependency>
        <groupId>org.springframework.webflow</groupId>
        <artifactId>org.springframework.binding</artifactId>
        <version>2.0.9.RELEASE</version>
    </dependency>

    <dependency>
        <groupId>org.springframework.webflow</groupId>
        <artifactId>org.springframework.js</artifactId>
        <version>2.0.9.RELEASE</version>
    </dependency>

    <dependency>
        <groupId>org.springframework.webflow</groupId>
        <artifactId>org.springframework.webflow</artifactId>
        <version>2.0.9.RELEASE</version>
    </dependency>

And if using JavaServerFaces:

    <dependency>
        <groupId>org.springframework.webflow</groupId>
        <artifactId>org.springframework.faces</artifactId>
        <version>2.0.9.RELEASE</version>
    </dependency>

Note the Web Flow artifacts in the SpringSource Bundle Repository are indexed under different ids because their transitive dependencies are different than the Maven Central artifacts. The difference is the transitive jars such as commons-logging have been patched by SpringSource to add the metadata required to make them OSGi-compatible.

### Accessing Web Flow bundles with Ivy

To access bundles using Ivy, add the following repositories to your Ivy config:

    <url name="com.springsource.repository.bundles.release">
        <ivy pattern="http://repository.springsource.com/ivy/bundles/release/
                      [organisation]/[module]/[revision]/[artifact]-[revision].[ext]" />
        <artifact pattern="http://repository.springsource.com/ivy/bundles/release/
                           [organisation]/[module]/[revision]/[artifact]-[revision].[ext]" />
    </url>

    <url name="com.springsource.repository.bundles.external">
        <ivy pattern="http://repository.springsource.com/ivy/bundles/external/
                      [organisation]/[module]/[revision]/[artifact]-[revision].[ext]" />
        <artifact pattern="http://repository.springsource.com/ivy/bundles/external/
                           [organisation]/[module]/[revision]/[artifact]-[revision].[ext]" />
    </url>

Then declare the following dependencies:

    <dependency org="org.springframework.webflow" name="org.springframework.binding"
                rev="2.0.9.RELEASE" conf="compile->runtime" />
    <dependency org="org.springframework.webflow" name="org.springframework.js"
                rev="2.0.9.RELEASE" conf="compile->runtime" />
    <dependency org="org.springframework.webflow" name="org.springframework.webflow"
                rev="2.0.9.RELEASE" conf="compile->runtime" />

And if using JavaServerFaces:

    <dependency org="org.springframework.webflow" name="org.springframework.faces"
                rev="2.0.9.RELEASE" conf="compile->runtime" />

### Accessing the dm Server Web Flow library

A dm Server library for Web Flow is also available if you are deploying to a dm Server environment. Import this library in your MANIFEST.mf to automatically import all Web Flow bundles. To access the library, add the following repository:

    <repository>
        <id>com.springsource.repository.libraries.release</id>
        <name>SpringSource Enterprise Bundle Repository - SpringSource Library Releases</name>
        <url>http://repository.springsource.com/maven/libraries/release</url>
    </repository>

And declare the following dependency:

    <dependency>
        <groupId>org.springframework.webflow</groupId>
        <artifactId>org.springframework.webflow-library</artifactId>
        <type>libd</type>
        <version>2.0.9.RELEASE</version>
    </dependency>

## How to access nightly builds

Nightly snapshots of Web Flow development branches are available using Maven, and distribution zips are also available for download. These snapshot builds are useful for testing out fixes you depend on in advance of the next release, and provide a convenient way for you to provide feedback about whether a fix meets your needs.

If using Maven, you may obtain snapshots from either the SpringSource-managed Maven Central-compatible repository or the SpringSource Enterprise Bundle Repository. Use the Maven Central-compatible snapshot repository when your project obtains its other open source dependencies from Maven Central. Use the Spring Source Enterprise Bundle Snapshot Repository when you wish to run Web Flow in an OSGi environment.

### Accessing snapshots from the Maven-central compatible repository

Add the following repository your pom:

    <repository>
        <id>org.springsource.maven.snapshot</id>
        <name>SpringSource Maven Central-compatible Snapshot Repository</name>
        <url>http://maven.springframework.org/snapshot</url>
    </repository>

Then declare the following dependencies:

    <dependency>
        <groupId>org.springframework.webflow</groupId>
        <artifactId>spring-binding</artifactId>
        <version>x.y.z.BUILD-SNAPSHOT</version>
    </dependency>

    <dependency>
        <groupId>org.springframework.webflow</groupId>
        <artifactId>spring-js</artifactId>
        <version>x.y.z.BUILD-SNAPSHOT</version>
    </dependency>

    <dependency>
        <groupId>org.springframework.webflow</groupId>
        <artifactId>spring-webflow</artifactId>
        <version>x.y.z.BUILD-SNAPSHOT</version>
    </dependency>

And if using JavaServerFaces:

    <dependency>
        <groupId>org.springframework.webflow</groupId>
        <artifactId>spring-faces</artifactId>
        <version>x.y.z.BUILD-SNAPSHOT</version>
    </dependency>

### Accessing snapshots from the SpringSource Enterprise Bundle Repository

Add the following repository your pom:

    <repository>
        <id>com.springsource.repository.bundles.snapshot</id>
        <name>SpringSource Enterprise Bundle Snapshot Repository</name>
        <url>http://repository.springsource.com/maven/bundles/snapshot</url>
    </repository>

Then declare the following dependencies:

    <dependency>
        <groupId>org.springframework.webflow</groupId>
        <artifactId>org.springframework.binding</artifactId>
        <version>x.y.z.BUILD-SNAPSHOT</version>
    </dependency>

    <dependency>
        <groupId>org.springframework.webflow</groupId>
        <artifactId>org.springframework.js</artifactId>
        <version>x.y.z.BUILD-SNAPSHOT</version>
    </dependency>

    <dependency>
        <groupId>org.springframework.webflow</groupId>
        <artifactId>org.springframework.webflow</artifactId>
        <version>x.y.z.BUILD-SNAPSHOT</version>
    </dependency>

And if using JavaServerFaces:

    <dependency>
        <groupId>org.springframework.webflow</groupId>
        <artifactId>org.springframework.faces</artifactId>
        <version>x.y.z.BUILD-SNAPSHOT</version>
    </dependency>

### Accessing snapshot distribution archives

Get the snapshot zip with the most recent CI build number from the Web Flow snapshot download area.