我正在使用 Spring WebFlow
我需要检查我是否有至少 15 个类型的 Practices 集合,如果没有,我无法转换到下一个流程。
我的注册流程:
<view-state id="practices" view="RegisterPractices" model="labs">
<transition on="add" to="createNewPractice"></transition>
<transition on="next" to="items" validate="true"></transition>
<transition on="back" validate="false" to="owners"></transition>
</view-state>
<subflow-state id="createNewPractice" subflow="addPractice">
<output name="practica" />
<transition on="practiceAdded" to="practices">
<evaluate expression="labs.addPractice(currentEvent.attributes.practice)"></evaluate>
</transition>
<transition on="practiceCancel" to="practices"></transition>
</subflow-state>
jsp实践:
<h2>Practices</h2>
<table class="standard-table" cellpadding="0" cellspacing="0">
<thead>
<tr>
<th>Practice</th>
<th>Operation</th>
<th>Action</th>
</tr>
</thead>
<tbody>
<c:forEach items="${ labs.practices }" var="practice">
<tr>
<td>${ practice.practice}</td>
<td><c:choose><c:when test="${ practice.realize == 1}">Realize</c:when><c:otherwise>Deriva</c:otherwise></c:choose></td>
</tr>
</c:forEach>
</tbody>
</table>
<div>
<a href="${flowExecutionUrl}&_eventId=add">Add a New Practice</a>
<a href="${flowExecutionUrl}&_eventId=next">Back</a>
<a href="${flowExecutionUrl}&_eventId=back">Next</a>
</div>
View-State 实践只是一个添加了实践列表的 jsp。
我尝试过使用 customValidator 但我无法处理 MessageBuilder.source() 因为我在该视图中没有任何对象。
我也尝试过决策状态,但我无法显示“您必须选择至少 15 种做法才能继续”这样的消息