简体   繁体   English

Spring Web Flow转换未触发

[英]Spring Web Flow transitions not triggered

I am using Spring Web Flow 2 and am having a basic problem getting my transitions to appropriately fire. 我正在使用Spring Web Flow 2,并且遇到一个基本问题,无法正确过渡。 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. 我已经在Internet上进行了很多搜索,但是未能找到关于如何从视图侧触发转换的深入说明。 I have two states: enterBookingDetails and reviewBooking. 我有两种状态:enterBookingDetails和reviewBooking。 EnterBookingDetails is working fine - the page is loading and on submit event, reviewBooking is loaded. EnterBookingDetails工作正常-页面正在加载,并且在提交事件时,会加载reviewBooking。 My problem is, I can't get any of the transitions from reviewBooking to work. 我的问题是,我无法实现从reviewBooking到工作的任何过渡。 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 (excerpt): enterBookingDetails.jsp(节选):

<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 (excerpt): reviewBooking.jsp(节选):

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>

When any of the buttons are clicked on "reviewBooking", the user is taken back to "enterBookingDetails" with none of the form data populated. 当单击“ reviewBooking”上的任何按钮时,用户将被带回到“ enterBookingDetails”,并且不填充任何表单数据。 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. 问题在于,这两个有问题的过渡都进入了结束状态,而我没有意识到,默认情况下,这些过渡会结束流程,然后重定向回第一页。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM