This repository was archived by the owner on Jul 2, 2026. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 138
Expand file tree
/
Copy pathbuy-flow.xml
More file actions
58 lines (44 loc) · 2.05 KB
/
Copy pathbuy-flow.xml
File metadata and controls
58 lines (44 loc) · 2.05 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
<?xml version="1.0" encoding="UTF-8"?>
<flow xmlns="http://www.springframework.org/schema/webflow"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://www.springframework.org/schema/webflow
http://www.springframework.org/schema/webflow/spring-webflow.xsd">
<var name="product" class="cn.devmgr.tutorial.webflow.pojo.Product" />
<var name="order" class="cn.devmgr.tutorial.webflow.pojo.Order" />
<!-- on-start 配置用户进入流程时预先的操作 -->
<on-start>
<!-- buyHandler 是spring的component,类似@Autowire方式 -->
<evaluate expression="buyHandler.init()" result="flowScope.shoppingCart" />
</on-start>
<view-state id="showCart" view="flows/buy/showcart" model="flowScope.shoppingCart">
<transition on="next" to="confirmOrder" />
<on-exit>
<!-- 离开这个页面会执行下面的内容 -->
<evaluate expression="buyHandler.updateShoppingCart(flowScope.shoppingCart)"></evaluate>
</on-exit>
</view-state>
<view-state id="confirmOrder" view="flows/buy/confirmorder" model="flowScope.shoppingCart">
<transition on="next" to="submitOrder" />
<transition on="modify" to="showCart" />
</view-state>
<action-state id="submitOrder">
<evaluate expression="buyHandler.createOrder(flowScope.shoppingCart, order, messageContext)" />
<transition on="success" to="payOrder" />
<transition on="fail" to="confirmOrder" />
</action-state>
<view-state id="payOrder" view="flows/buy/payorder" model="order">
<transition on="pay" to="pay" />
</view-state>
<action-state id="pay">
<evaluate expression="buyHandler.payOrder(order)" />
<transition on="success" to="completion" />
<transition on="failure" to="pay" />
</action-state>
<!-- end state -->
<end-state id="completion" view="flows/buy/completion" />
<end-state id="home" view="externalRedirect:contextRelative:/" />
<!-- Global Transition -->
<global-transitions>
<transition on="home" to="home" validate="false" />
</global-transitions>
</flow>