在下面的Web Flow中,我将表单数据绑定到视图状态下的提交事件的流变量(lifeCycleForm)。我已经验证过,名称,标签和说明属性均按预期填充。如何在Spring Web Flow 2中的视图状态和操作状态之间传递模型数据
但是,当评估操作状态中的表达式时,所有三个属性均为空。我的表单bean是可序列化的,我只是使用简单的字符串属性。
我做错了什么?
我是Spring WebFlow的新手,所以我可能错失了一些明显的东西。
<var name="lifeCycleForm" class="com.btmatthews.freelancer.lifecycle.portlet.LifeCycleForm" />
<view-state id="createLifeCycle" model="lifeCycleForm">
<binder>
<binding property="name" required="true" />
<binding property="label" required="true" />
<binding property="description" required="false" />
</binder>
<transition on="submit" to="createLifeCycleAction" />
<transition on="cancel" to="lifeCycleCreationCancelled" bind="false" />
</view-state>
<action-state id="createLifeCycleAction">
<evaluate expression="lifeCycleService.createLifeCycle(lifeCycleForm.name, lifeCycleForm.label, lifeCycleForm.description, null, null)" />
<transition on="success" to="lifeCycleCreated" />
<transition on="failure" to="createLifeCycle" />
</action-state>
<end-state id="lifeCycleCreated" />
<end-state id="lifeCycleCreationCancelled" />
更新:我忽略了我原来的帖子提到,有人认为是失败的我的单元测试。从那以后,我了解到AbstractFlowExecutionTests没有实现请求参数的绑定。这对我来说似乎有点疏忽了。我已经试过最新的每晚Spring WebFlow 2.0.4,并且行为依然如此。
更新:我的问题是,Spring WebFlow嘲笑不模拟表单提交。
由于提前, 布赖恩
我唯一的建议是将LifeCycleForm作为一个完整的对象(不是一片一片地)传递给lifeCycleService,并通过调试来查看该方法是什么样的......我没有发现任何错误, ,但我只使用Webflow 1.0 :( – MetroidFan2002 2008-10-23 01:32:28