快速业务通道

用Spring Web Flow和Terracotta搭建Web应用 - 编程入门网

作者 佚名技术 来源 NET编程 浏览 发布时间 2012-06-19
流转定义实现如下:

<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-1.0.xsd">    <var name="sale" class="org.springframework.webflow.samples.sellitem.Sale"/>    <start-state idref="enterPriceAndItemCount"/>    <view-state id="enterPriceAndItemCount" view="priceAndItemCountForm">      <transition on="submit" to="enterCategory"/>    </view-state>    <view-state id="enterCategory" view="categoryForm">      <transition on="submit" to="requiresShipping"/>    </view-state>    <decision-state id="requiresShipping">      <if test="${flowScope.sale.shipping}" then="enterShippingDetails" else="finish"/>    </decision-state>    <view-state id="enterShippingDetails" view="shippingDetailsForm">       <transition on="submit" to="finish"/>    </view-state>    <end-state id="finish" view="costOverview"/> </flow>

用Spring Web Flow和Terracotta搭建Web应用(5)

时间:2011-02-05 infoq Jonas Bonér & Eu

我们从上面的定义可以看到,实际状态与状态图中的状态对应,状态转换与图中的箭头对应。"sale" bean是流转开始时分配的流转变量实例。它持有了Sale相关的属性。

上面的定义展示了所有的导航逻辑,但还没有实现任何应用行为。特别是在用户提交时更新Sale Bean的逻辑还没有实现。另外后台的sale处理逻辑还没有定义。

实现了所有必需行为的完整Spring Web Flow定义如下:

<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-1.0.xsd">     <var name="sale" class="org.springframework.webflow.samples.sellitem.Sale"/>     <start-state idref="enterPriceAndItemCount"/>     <view-state id="enterPriceAndItemCount" view="priceAndItemCountForm">       <render-actions>           <action bean="formAction" method="setupForm"/>      </render-actions>      <transition on="submit" to="enterCategory">        <action bean="formAction" method="bindAndValidate">          <attribute name="validatorMethod" value="validatePriceAndItemCount"/>        </action>      </transition>     </view-state>     <view-state id="e

凌众科技专业提供服务器租用、服务器托管、企业邮局、虚拟主机等服务,公司网站:http://www.lingzhong.cn 为了给广大客户了解更多的技术信息,本技术文章收集来源于网络,凌众科技尊重文章作者的版权,如果有涉及你的版权有必要删除你的文章,请和我们联系。以上信息与文章正文是不可分割的一部分,如果您要转载本文章,请保留以上信息,谢谢!

分享到: 更多

Copyright ©1999-2011 厦门凌众科技有限公司 厦门优通互联科技开发有限公司 All rights reserved

地址(ADD):厦门软件园二期望海路63号701E(东南融通旁) 邮编(ZIP):361008

电话:0592-5908028 传真:0592-5908039 咨询信箱:web@lingzhong.cn 咨询OICQ:173723134

《中华人民共和国增值电信业务经营许可证》闽B2-20100024  ICP备案:闽ICP备05037997号