diff --git a/spring-webflow-samples/getting-started-with-spring-webflow/src/main/webapp/WEB-INF/tutorial/webflowExercise.jsp b/spring-webflow-samples/getting-started-with-spring-webflow/src/main/webapp/WEB-INF/tutorial/webflowExercise.jsp index 2ae63f42..5ca99d7f 100644 --- a/spring-webflow-samples/getting-started-with-spring-webflow/src/main/webapp/WEB-INF/tutorial/webflowExercise.jsp +++ b/spring-webflow-samples/getting-started-with-spring-webflow/src/main/webapp/WEB-INF/tutorial/webflowExercise.jsp @@ -5,6 +5,8 @@
+
<html>
<head>
<title>Hello world!</title>
</head>
<h1>Hello world!</h1>
</html>
+
+
<transition on="submit" to="page2" />
+
Then define your page2 view-state:
+
<view-state id="page2">
</view-state>
+
And the corresponding page2.jsp:
+
<html>
<head>
<title>Hello world!</title>
</head>
<h1>This is page 2!</h1>
</html>
+
Finally, create a button on your start.jsp that raises the submit event to trigger the state transition:
+
<form method="post">
<input type="submit" name="_eventId_submit" value="Submit" />
</form>
+
Click the button and you should be taken to page 2.
+
<%@ taglib prefix="form" uri="http://www.springframework.org/tags/form" %>
<html>
<head>
@@ -136,11 +149,13 @@
<input type="submit" name="_eventId_submit" value="Submit" />
</form:form>
</html>
+
+
package org.springframework.webflow.samples.helloworld;
import java.io.Serializable;
@@ -156,16 +171,21 @@
this.selected = selected;
}
}
+
+
<var name="helloWorldForm" class="org.springframework.webflow.samples.helloworld.HelloWorldForm" />
+
Then update your start view-state to use this variable as its data model, enabling automatic model binding and validation:
- <view-state id="start" model="helloWorldForm"> ...
+
+ <view-state id="start" model="helloWorldForm"> ...
+
Refresh your flow and the checkbox should render checked since the default value for the HelloWorldForm selected property is true. @@ -174,7 +194,8 @@
++Be sure to update your start view-state to transition to the isSelected decision state instead of page2 directly:<decision-state id="isSelected"> <if test="helloWorldForm.selected" then="page2" else="page3" /> </decision-state> @@ -183,13 +204,16 @@ </view-state> <view-state id="page3"> - </view-state> + </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). @@ -202,15 +226,21 @@<view-state id="start"> <transition on="submit" to="isSelected" /> - </view-state> + </view-state> +
+
<input type="submit" name="_eventId_finish" value="Finish" />
+
In your start view-state, declare the finish transition:
+
<transition on="finish" to="finished" />
+
And finally define the end-state:
+
<end-state id="finished" view="externalRedirect:welcome" />
+
Click the Finish button and you should be taken back to the application welcome screen.