3

I've the following view-state:

<view-state id="editbestellung" view="eap/orderedit.xhtml"
    model="flowScope.entity">
    <transition on="save" to="eaporderlist" bind="true">
        <evaluate
            expression="eapBestellungDelegate.save(flowScope.entity,currentUser.name)" />
    </transition>
</view-state>

No elsewhere I set a flowScope.isToDo on true.
Now I need to check if this flowScope is true. If it is, the transition should redirect to="eapordertodolist" and if it is false, it should go to="eaporderlist".
But I only know how to set the if-statement like that:

<if test="testingMethod()" then="view-state when true" else="view-state when false" />

So how can I implement the if-statement inside of the view-state above and do the needed actions?

4

1 回答 1

3

使用决策状态

使用决策状态元素作为操作状态的替代,以使用方便的 if/else 语法做出路由决策。下面的示例显示了上面的 moreAnswersNeeded 状态现在实现为决策状态而不是动作状态

您的editbestellung-state 将如下所示(注意我更改了to):

<view-state id="editbestellung" view="eap/orderedit.xhtml"
    model="flowScope.entity">
    <transition on="save" to="eaporderdecision" bind="true">
        <evaluate
            expression="eapBestellungDelegate.save(flowScope.entity,currentUser.name)" />
    </transition>
</view-state>

然后添加决策状态:

<decision-state id="eaporderdecision">
    <if test="flowScope.isToDo" then="eapordertodolist" else="eaporderlist" />
</decision-state>
于 2013-08-20T09:03:59.103 回答