Spring Web Flow – using Eclipse IDE (Tutorial)

I’ve been looking online lately for tutorials on Spring Web Flow, and I didn’t find any that were succinct, memorable, or very appealing. For every tutorial that you find online, that framework may be out of date, and another may be in date; but be horrendously long to read… This article helps challenge these attributes.

For this tutorial I am using:

IDE: Eclipse (Java EE)
Build tool: Maven
Framework: Spring v4 << the important bit ... and Java, obviously.

Step 1:

Create a new project in Eclipse. You’ll need to open ‘other’ option under the New menu heading. A new window will open – select Maven -> Maven Project.

Step 2:

Setup your Spring dependencies.

When you create a new Maven project (under File -> New -> Other…), you will need to use your default workspace location, using the ‘maven-archetype-webapp’ artifact ID. Give your Maven project a name, followed by the parent package that you want to create for this project.

Open the pom.xml file under the root of your application’s directory.

With your pom.xml configuration file open, you’ll need to specify to Maven what Java libraries your application will need to build, deploy and run.

To create a Spring Web Flow application, we’ll need three components belonging to the Spring framework, those being: Spring Core, Spring MVC and Spring Web Flow. We will also need Spring Boot, Spring Web, Spring Context and Spring Autoconfigure.

The framework itself isn’t one dependency, more-over is an assortment of components, (I presume) for the purpose of modularity and performance.








Figure 1. Maven dependencies – feel free to copy n’ paste!

Step 2: Write code like MVC… not ABC…

We’ve got the important stuff out of the way. We can now focus on writing our Java code!

To begin with, we’re going to write the root of our application.

Start by creating a new Java class and name it something like Application. This will allow us to compile and execute the application on our local Tomcat server.

package com.learning.spring.webflow;

import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;

public class Application {

public static void main(String [] args) {
SpringApplication.run(Application.class, args);


This very small and simple class simply instructs the Spring boot component to execute our code against the JVM.

Next, we need to create a class which will act as the Controller (eventually) in our Spring Web Flow application.

// Spring MVC component
import org.springframework.stereotype.Controller;

// Spring Web component
import org.springframework.web.bind.annotation.RequestMapping;

public class HolidayBookingFormController {

public String holidayChooseDates() {


public String holidayNumberOfGuests() {


public String holidayChooseFlights() {


public String holidayChooseExtras() {


public String holidayConfirmBooking() {



For each of the methods contained within this controller, each HTTP request maps (corresponds) with the JSP that will handle the presentation of our application.

Step 3: Create the JSP’s!

This entry was posted in Java, Software Engineering. Bookmark the permalink. Follow any comments here with the RSS feed for this post. Post a comment or leave a trackback: Trackback URL.

Post a Comment

Your email is never published nor shared. Required fields are marked *


You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong>