以下の Web フローでは、フォーム データをビュー ステートの送信イベントでフロー変数 (lifeCycleForm) にバインドします。名前、ラベル、および説明のプロパティがすべて期待どおりに設定されていることを確認しました。
ただし、アクション状態の式が評価されると、3 つのプロパティはすべて null になります。私のフォーム 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 モックがフォーム送信をシミュレートしないことです。
前もって感謝します、ブライアン