Building the Spring Web Flow Distribution
The code in this article is written using Spring Web Flow 1.0.5. Because I experienced some firewall problems when building the latest release (version 2.0.3 at the time of writing), I decided to use the earlier version. The firewall issues are under discussion in the Spring Forum, so I imagine that they'll be fixed soon. In any case, the later release will almost certainly include the same examples I describe here. So, with a little luck you shouldn't have any problems—firewalls or otherwise—when you move to the next version!
To run the code in this article, you'll need to download a distribution of Spring Web Flow. The build requires Ant and JDK 1.3 (or later), at a minimum. To run the examples, you'll also need our faithful old friend, Tomcat.
Building the distribution is really very straightforward:
- Download the Spring distribution.
- Unzip the archive to a folder. For this example, I used the following folder:
C:\java\spring-webflow
- Open a DOS command console.
- Change directories to the following location:
C:\java\spring-webflow\spring-webflow-1.0.5\projects\build-spring-webflow
- Run the following command:
ant dist
- Go for a coffee or a short stroll as the build runs. On my system, the build took only about two minutes.
Once the build is complete, you'll find the WAR files located in the folders here:
C:\java\spring-webflow\spring-webflow-1.0.5\projects
As for building, it's very straightforward to run the examples on Tomcat. For instance, to run the itemlist example, follow these steps:
- Open the following folder:
C:\java\spring-webflow \spring-webflow-1.0.5\projects\spring-webflow-samples\itemlist\target\artifacts\war
- Copy the file swf-itemlist.war to the webapps folder of your Tomcat installation.
- Open the bin folder of your Tomcat installation.
- Double-click the file tomcat6.exe to start Tomcat and deploy and run the itemlist web application.
If you prefer, you can run Tomcat as a Windows service, in which case you can omit steps 3–4. You can test the deployed application by browsing the following URL, where you should see something like Figure 1:
http://localhost:8080/swf-itemlist/
Figure 1 The itemlist web app.
You can play around with this really simple application by clicking one of the two links in Figure 1. Each of the links presents a screen that in turn allows you to create "items," which are added to an ever-expanding list. I did say that it's simple! As you'll see later, Figure 1 is the very first step in the Spring web flow application. Let's break down this application into its component parts.