Vinod
Vinod

Reputation: 2311

Issue with multiple evaluate expressions in action-state in Spring Web flow

I have one action state where I need to excecute two evaluate expressions in which both expressions will return corresponding beans. My problem is In my action state only one evaluate expression is excecuting in the following code,

<action-state id="confirmState">
    <evaluate expression="myController.getConfirmPage(flowRequestContext,conversationScope.studentTypeBean)" result="conversationScope.studentTypeBean"/>
    <evaluate expression="myPageController.getHomePage(flowRequestContext)" result="conversationScope.studentBean"    />
    <transition to="studentConfirm"></transition>         
</action-state>

Some tutorials says that to excecute mutiple evaluate expressions the first expression need to return true in order to excecute the second expression, Is that true? But I want to return a bean instead boolean in my case. How can I solve the issue?

Upvotes: 1

Views: 3224

Answers (3)

Gil Beyruth
Gil Beyruth

Reputation: 608

I believe you can have multiples, as long as the top methods return true, and not void.

Upvotes: 0

Phillip
Phillip

Reputation: 31

I had the same issue. I found this worked for me:

<action-state id="confirmState">
    <evaluate expression="myController.getConfirmPage(flowRequestContext,conversationScope.studentTypeBean)" result="conversationScope.studentTypeBean"/>
    <transition to="studentConfirm">
        <evaluate expression="myPageController.getHomePage(flowRequestContext)" result="conversationScope.studentBean"    />
    </transition>         
</action-state>

Upvotes: 3

rptmat57
rptmat57

Reputation: 3787

you could use like this:

<action-state id="confirmState">
    <on-entry>
        <evaluate expression="myController.getConfirmPage(flowRequestContext,conversationScope.studentTypeBean)" result="conversationScope.studentTypeBean"/>
    </on-entry>
    <evaluate expression="myPageController.getHomePage(flowRequestContext)" result="conversationScope.studentBean"/>
    <transition to="studentConfirm"/>         
</action-state>

but if this is really your action state, I don't think there is a need for it. Assuming you get to "confirmState" via a single confirmState transition, you could simplify to:

<transition on="confirmState" to="studentConfirm">
    <evaluate expression="myController.getConfirmPage(flowRequestContext,conversationScope.studentTypeBean)" result="conversationScope.studentTypeBean"/>
    <evaluate expression="myPageController.getHomePage(flowRequestContext)" result="conversationScope.studentBean"/>
</transition>

Upvotes: 2

Related Questions