Webflow 2.0 问题
我有一个可以返回多个事件的视图状态。 对于他们中的大多数人来说,有一个我想要“评估”的通用 jave 方法。 我想做一些不同的事情的地方很少。 然而,每个事件都会转变为不同的状态。 我的网络流代码现在多次重复该方法的评估,每个适用的转换一次。 当然,如果我想始终评估该方法,我可以在退出时调用它,但由于我不想在所有情况下都这样做,所以我只能在转换调用中重复它。 还有其他方法可以做到这一点吗?
坦率
I have a view-state that can return multiple events. For most of them, there is a common jave method I want to "evaluate." There are are few where I want to do something different. Each event, however, will transition to a different state. My web flow code now is repeating the evaluate of the method multiple times, once for each applicable transition. Of course, if I wanted to always evaluate the method, I could call it in the on-exit, but since I don't want to do it in all cases, I'm stuck repeating it in the transition calls. Is there any other way to do this?
Frank
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
转换到决策状态评估,然后使用 currentEvent.id 转换到原始目标 smt,如下所示:
<决策状态 id="决策">
>;
;
>
<进入时>
<评价...
transition to a decision-state evaluate there, and than transition with currentEvent.id to the original target smt like :
<decision-state id="decision">
<on-entry>
<evaluate ...
</on-entry>
<if test="currentEvent.id=='goruntule'" then="goruntule"/>
<if test="currentEvent.id=='guncelle'" then="guncelle"/>
<if test="currentEvent.id=='sil'" then="sil"/>
</decision-state>
这听起来像是您可能会考虑将当前在流 XML 本身中编码的一些逻辑移动到对 Action POJO 的调用中的情况。 也许在退出时对 Action 进行一次调用,传入流请求上下文,并让 Action 方法本身(根据请求参数)确定是否应调用常用 Java 方法。
像这样的事情:
This sounds like a situation where you might consider moving some of the logic that is currently encoded in the flow XML itself into a call to an Action POJO. Perhaps a single call to an Action on on-exit, passing in the flow request context and let the Action method itself figure out (from request parameters) whether your common Java method should be invoked.
Something like this: