Spring Web Flow转换未触发 [英] Spring Web Flow transitions not triggered

查看:130
本文介绍了Spring Web Flow转换未触发的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用Spring Web Flow 2,并且遇到一个基本问题,无法正确过渡到我.我已经在Internet上进行了大量搜索,但是无法找到关于如何从视图侧触发转换的深入说明.我有两种状态:enterBookingDetails和reviewBooking. EnterBookingDetails工作正常-页面正在加载,并且在提交事件时,会加载reviewBooking.我的问题是,我无法获得从reviewBooking到工作的任何过渡.这是我所拥有的:

I am using Spring Web Flow 2 and am having a basic problem getting my transitions to appropriately fire. I have done a lot of searching on the internet and have been unable to find an in-depth explanation of how transitions are triggered from the view side. I have two states: enterBookingDetails and reviewBooking. EnterBookingDetails is working fine - the page is loading and on submit event, reviewBooking is loaded. My problem is, I can't get any of the transitions from reviewBooking to work. Here is what I have:

booking-flow.xml:

booking-flow.xml:

<var name="bookingForm" class="com.mypackage.CarBookingForm"/>

<view-state id="enterBookingDetails" model="bookingForm">
    <transition on="submit" to="reviewBooking" />
</view-state>

<view-state id="reviewBooking" model="bookingForm">
    <transition on="confirm" to="bookingConfirmed" />
    <transition on="revise" to="enterBookingDetails" />
    <transition on="cancel" to="bookingCancelled" />
</view-state>

<end-state id="bookingConfirmed" />

<end-state id="bookingCancelled" />

enterBookingDetails.jsp(摘录):

enterBookingDetails.jsp (excerpt):

<form:form modelAttribute="bookingForm">
    Pickup: <form:input path="pickUpLocation"/><br />
    Dropoff: <form:input path="dropOffLocation"/><br />
    <input type="submit" name="_eventId_submit" value="Confirm"/>
    <input type="submit" name="_eventId_other" value="Other"/>
</form:form>

reviewBooking.jsp(摘录):

reviewBooking.jsp (excerpt):

Pickup Loc: ${bookingForm.pickUpLocation}<br />
Dropoff Loc: ${bookingForm.dropOffLocation}<br />

<form>
    <input type="submit" name="_eventId_confirm" value="Confirm" />
    <input type="submit" name="_eventId_revise" value="Revise" />
    <button type="submit" name="_eventId_cancel">Cancel</button>
    <input type="hidden" name="_flowExecutionKey" value="${flowExecutionKey}" />
</form>

当单击"reviewBooking"上的任何按钮时,用户将被带回到"enterBookingDetails",并且不填充任何表单数据.预先感谢您的帮助.

When any of the buttons are clicked on "reviewBooking", the user is taken back to "enterBookingDetails" with none of the form data populated. Thanks in advance for your help.

推荐答案

好的,我发现了问题所在.实际上,所有过渡都在触发.问题在于,这两个有问题的过渡都进入了结束状态,而我没有意识到默认情况下这些过渡会结束流程,然后重定向回第一页.

OK, I figured out the problem. All of the transitions were actually firing. The issue was that the two problematic transitions went to end states, and I didn't realize that by default those were ending the flow and then redirecting back to the first page.

这篇关于Spring Web Flow转换未触发的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆