Scaffolding with Spring Web Flow 2.0
This tutorial walks you through the generation of software components for Spring Web Flow, which is a project from Spring for simplifying the development of web applications. While Spring Web Flow is compatible with Spring MVC, Spring Web Flow uses flows instead of controllers for implementing the web layer of an application. In this tutorial, you will learn how to:
- Scaffold from database tables into an existing project
- Deploy the application
1. Create a Web Project
Create a MyEclipse Web project called CustomersWebFlowApp.
Note: If you get a popup regarding the project compiler compliance level not matching the workspace default, specify that you want to use a custom setting for the project by clicking Yes.
2. Scaffold from Database Tables
Scaffolding with Web Flow requires the same steps as scaffolding with Spring MVC. Follow the steps in Scaffolding a Spring MVC Application with the following exception:
Select the Generate checkbox for Spring Web Flow on the Select Web Client Type wizard page.
3. Deploy the App
- Right-click CustomersWebFlowApp, and select Run As>MyEclipse Server Application. Select the MyEclipse Tomcat server.
MyEclipse Tomcat starts and opens the application. The first page is a dashboard for accessing all scaffolded web clients. Because this tutorial only scaffolded a single parent object for Spring Web Flow, the only option under Spring Web Flow is View Customers. - Click View Customers to see the generated application in operation. If you want to run the Spring Web Flow application in a separate browser, use the following URL: http://localhost:8080/CustomersWebFlowApp/.
The Spring Web Flow application can be used to perform create, read, update, and delete functions on Employees and Offices. The following image shows some of the views.
4. What’s Generated?
To ease your way into code generation with ME4S, this tutorial involved scaffolding from only a single database table. Therefore, only the software components for managing a single entity were generated, and there were no entity relationships. When you start generating for multiple entities, potentially with entity relationships, there are many more software components generated than were generated with this tutorial. Even though there’s a lot more code, it is grouped and organized as shown in the following images.