polish
This commit is contained in:
@@ -22,7 +22,7 @@
|
||||
<p>
|
||||
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.
|
||||
</p>
|
||||
<h2>
|
||||
@@ -52,7 +52,7 @@
|
||||
<h3>Create your first helloworld flow</h3>
|
||||
<ol>
|
||||
<li>
|
||||
Once the application is running, create a new directory for your flow inside /WEB-INF; name the directory helloworld.
|
||||
Once the application is running, create a new directory for your flow inside /src/main/webapp/WEB-INF; name the directory helloworld.
|
||||
Next, right-click on the directory and access New -> Spring Web Flow Definition.
|
||||
Enter the filename helloworld-flow.xml and finish.
|
||||
The flow definition will be generated for you with an initial view-state named start.
|
||||
@@ -71,7 +71,7 @@
|
||||
</pre>
|
||||
</li>
|
||||
<li>
|
||||
From the Servers view, restart your server, then startup your flow by accessing <a href="http://localhost:8080/app/helloworld">http://localhost:8080/app/helloworld</a>.
|
||||
From the Servers view, restart your server, then startup your flow by accessing <a href="http://localhost:8080/getting-started-with-spring-webflow/app/helloworld">http://localhost:8080/getting-started-with-spring-webflow/app/helloworld</a>.
|
||||
You should see your Hello world! message display.
|
||||
Note you only have to restart your server when you add new flows to the system. When you change flows, changes will be refreshed automatically.
|
||||
</li>
|
||||
@@ -114,8 +114,8 @@
|
||||
</p>
|
||||
<ol>
|
||||
<li>
|
||||
Try implementing a dynamic navigation rule by adding a bound checkbox to your start.jsp.
|
||||
Do this by first replacing the contents of your start.jsp with the following snippet:
|
||||
Try implementing a dynamic navigation rule by first adding a bound checkbox to your start.jsp.
|
||||
Do this by replacing the contents of your start.jsp with the following snippet:
|
||||
<pre>
|
||||
<%@ 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 @@
|
||||
</pre>
|
||||
</li>
|
||||
<li>
|
||||
In your helloworld-flow, declare the HelloWorldForm as a flow variable:
|
||||
At the top of your helloworld-flow, declare the HelloWorldForm as a flow variable:
|
||||
<pre>
|
||||
<var name="helloWorldForm" class="org.springframework.webflow.samples.helloworld.HelloWorldForm" />
|
||||
</pre>
|
||||
@@ -167,23 +167,25 @@
|
||||
</p>
|
||||
</li>
|
||||
<li>
|
||||
Add a navigation decision that says if selected goto page2 else goto a new page3:
|
||||
<pre>
|
||||
<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:
|
||||
<pre>
|
||||
<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>
|
||||
|
||||
</pre>
|
||||
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:
|
||||
<pre>
|
||||
<view-state id="start">
|
||||
<transition on="submit" to="isSelected" />
|
||||
</view-state>
|
||||
</pre>
|
||||
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).
|
||||
</li>
|
||||
</ol>
|
||||
|
||||
@@ -29,7 +29,7 @@ The framework also cares for managing conversational state and preventing duplic
|
||||
<p>
|
||||
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.
|
||||
</p>
|
||||
<p>
|
||||
|
||||
@@ -8,6 +8,10 @@
|
||||
<h1>
|
||||
Setting up Web Flow in a Spring Web Application
|
||||
</h1>
|
||||
<p>
|
||||
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 <a href="tutorial?execution=${flowExecutionKey}&_eventId=next"">skip</a> this step.
|
||||
</p>
|
||||
<h2>
|
||||
What does the configuration of a typical Spring web application look like?
|
||||
</h2>
|
||||
@@ -127,7 +131,7 @@
|
||||
This is done by consulting an ordered chain of HandlerMapping objects configured in your mvc-config.xml.
|
||||
Generally, the first HandlerMapping consulted is the FlowHandlerMapping, which determines if the requested resource should be handled by a web flow.
|
||||
If no flow handler is found, the next HandlerMapping in the chain is queried.
|
||||
This is generally the DefaultAnnotationHandlerMapping, which consults explicit @RequestMapping rules defined inside annotated Spring MVC @Controllers.
|
||||
This is generally the DefaultAnnotationHandlerMapping, which consults explicit @RequestMapping rules defined inside annotated Spring MVC Controllers.
|
||||
</p>
|
||||
<p>
|
||||
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 @@
|
||||
</p>
|
||||
<pre class="code">
|
||||
<!-- 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" />
|
||||
|
||||
Reference in New Issue
Block a user