gpt4 book ai didi

java - Spring Web Flow - 集成 Javascript 确认决策

转载 作者:行者123 更新时间:2023-12-03 12:32:23 25 4
gpt4 key购买 nike

我想将 JavaScript 对话框集成到 Web 流程的开头,其中所选的选项确定是否将现有对象添加到流程中或添加新对象。

<on-entry>
<evaluate expression="appService.checkMembershipStatus(memberId)"/>
// this will check if the state is 'RENEW' and return boolean
// If returns true, then show javascript dialog to say "Renew existing?".
//If they select 'Yes', the existing membership is loaded into the flowScope.
//If they select 'No', then a new membership (object) is loaded into the flowscope
// else
// A new memebership (object) is loaded into the flowscope

</on-entry>

<view-state id="begin">
// continue as normal
</view-state>

谢谢

最佳答案

您可以使用 <decision-state> 来实现此目的。示例流程如下

<view-state id="screen1">
<transition to="checkMembershipStatus" />
</view-state>

<decision-state id="checkMembershipStatus">
<if test="appService.checkMembershipStatus(memberId)"
then="renewMembership"
else="loadNewMember" />
</decision-state>

<!--In this page show a javascript dialog (or custom JSP page) on load to get the answer [YES/NO] -->
<view-state id="renewMembership">
<transition on="Yes" to="loadExistingMember" />
<transition on="No" to="loadNewMember" />
</view-state>

<action-state id="loadExistingMember">
<evaluate expression="loadExistingMember()" result="member" />
<transition to="begin" />
</action-state>

<action-state id="loadNewMember">
<evaluate expression="loadnewMember()" result="member" />
<transition to="begin" />
</action-state>

<view-state id="begin">
// continue as normal
</view-state>

关于java - Spring Web Flow - 集成 Javascript 确认决策,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/23876008/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com