我正在使用 Spring Web Flow 2,并且在让我的转换正确触发时遇到了一个基本问题。我在互联网上进行了大量搜索,但无法找到有关如何从视图侧触发转换的深入解释。我有两种状态:enterBookingDetails 和 reviewBooking。EnterBookingDetails 工作正常 - 页面正在加载,在提交事件时,reviewBooking 已加载。我的问题是,我无法从 reviewBooking 到工作的任何过渡。这是我所拥有的:
预订流程.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" />
进入BookingDetails.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(摘录):
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”,没有填充任何表单数据。在此先感谢您的帮助。