From a1c6c27e6eb20cb02d6107cb183d42319d2270fa Mon Sep 17 00:00:00 2001
From: Keith Donald
XML is a good format for expressing structure.
Since a flow definition primarily captures the navigation structure between your pages, XML is a good fit.
- XML is not an appropriate for general programming.
+ XML is not appropriate for general programming.
This is why your flows should invoke actions written in Java or Groovy to carry out application behaviors.
@@ -52,7 +52,7 @@
Create your first helloworld flow
<%@ taglib prefix="form" uri="http://www.springframework.org/tags/form" %>
<html>
@@ -139,7 +139,7 @@
import java.io.Serializable;
- public class HelloworldForm implements Serializable {
+ public class HelloWorldForm implements Serializable {
private boolean selected = true;
public boolean isSelected() {
@@ -153,7 +153,7 @@
<var name="helloWorldForm" class="org.springframework.webflow.samples.helloworld.HelloWorldForm" />@@ -167,23 +167,25 @@
- <view-state id="start"> - <transition on="submit" to="isSelected" /> - </view-state> - + Now insert a decision state that says if the checkbox is selected goto page2, else goto a new page3: +<decision-state id="isSelected"> <if test="helloWorldForm.selected" then="page2" else="page3" /> </decision-state> - ... + <view-state id="page2"> + </view-state> <view-state id="page3"> </view-state> -- Click the button with the checkbox selected and you should be taken to page2. + Be sure to update your start view-state to transition to the isSelected decision state instead of page2 directly: ++ <view-state id="start"> + <transition on="submit" to="isSelected" /> + </view-state> ++ Click the Submit button with the checkbox selected and you should be taken to page2. Click the button with the checkbox de-selected and you should be taken to page3 (you'll need to create a JSP or you'll get a 404).
Spring Web Flow builds on the Spring Framework project, which includes the Spring MVC web framework. Concretely, Spring Web Flow plugs into Spring MVC as a Controller technology. -A typical Spring-powered web application is implemented using a mix of annotated Spring MVC @Controllers and web flows. +A typical Spring-powered web application is implemented using a mix of annotated Spring MVC Controllers and web flows. In general, use @Controllers for implementing simple, single-request user interactions, and web flows for stateful, multi-step user interactions.
diff --git a/spring-webflow-samples/getting-started-with-spring-webflow/src/main/webapp/WEB-INF/tutorial/webflowSetup.jsp b/spring-webflow-samples/getting-started-with-spring-webflow/src/main/webapp/WEB-INF/tutorial/webflowSetup.jsp index 0320ba9a..3395b052 100644 --- a/spring-webflow-samples/getting-started-with-spring-webflow/src/main/webapp/WEB-INF/tutorial/webflowSetup.jsp +++ b/spring-webflow-samples/getting-started-with-spring-webflow/src/main/webapp/WEB-INF/tutorial/webflowSetup.jsp @@ -8,6 +8,10 @@
+This step covers the one-time configuration step of setting Web Flow up in a Spring web application. +If you prefer to go right to implementing your first flow, you can skip this step. +
Setting up the HandlerMapping chain is a one-time configuration step, and makes it easy to plug in different types of handlers and mapping strategies. @@ -135,7 +139,7 @@
<!-- Maps requests to flows in the flowRegistry; for example, a request for resource /hotels/booking maps to a flow with id "hotels/booking" - If no flow is found with that id, Spring MVC proceeds to the next HandlerMapping (order=1 below). --> + If no flow is found with that id, Spring MVC proceeds to the next HandlerMapping (order=1 below). --> <bean id="flowMappings" class="org.springframework.webflow.mvc.servlet.FlowHandlerMapping"> <property name="order" value="0" /> <property name="flowRegistry" ref="flowRegistry" />