情况:我正在开发一个spring mvc网络流程应用,因为我有两个表customer
和customerAdress
以及两个相应的模型:customerModel
和customerAdressModel
,现在跟随我的flow.xml:
<var name="customer" class="com.model.Customer"/>
<var name="customerAdress" class="com.model.CustomerAdress"/>
<var name="id">
<view-state id="customer" view="customerView.jsp" model="customer">
<transition on="next" to="customerAdress"/>
</view-state>
<view-state id="customerAdress" view="customerAdressView.jsp" model="customerAdress">
<transition on="next" to="insertCustomer"/>
</view-state>
<action-state id="insertCustomer">
<evaluate expression="Buisness.insertCustomer(customer)"/>
<evaluate expression="Buisness.fetchCustomerId(customer)" result="id"/>
<evaluate expression="Buisness.insertCustomerAdress(id,cutomerAdress)"/>
</action-state>
现在insertCustomer
插入客户,fetchCustomerId
提取客户ID,insertCusotomerAdress
按id
问题:我的问题是此代码无效,具体insertCustomerAdress
无法正常工作,我认为我在判断id
或分配商务服务的价值方面犯了一些错误到id
,有人可以告诉我正确的语法吗?
答案 0 :(得分:0)
默认情况下,操作状态仅执行第一个操作。要执行一系列操作,请使用Named actions。
<action-state id="insertCustomer">
<evaluate expression="Buisness.insertCustomer(customer)">
<attribute name="name" value="insertCustomer" />
</evaluate>
<evaluate expression="Buisness.fetchCustomerId(customer)" result="id">
<attribute name="name" value="fetchCustomerId" />
</evaluate>
<evaluate expression="Buisness.insertCustomerAdress(id,cutomerAdress)">
<attribute name="name" value="insertCustomerAdress" />
</evaluate>
<transition on="insertCustomerAdress.success" to="[state id to transit]" />
</action-state>