3

Have implemented switch statement as below.

Could you please verify and correct it if there is any wrong?

<set name="flowScope.Valid" value="true">
<decision-state id="isDNCheckNotRequired" test="Valid == true">
<transition on="true" to="even"/>
<transition on="false" to="odd"/>
</decision-state>

<action-state id="even">
<evaluate expression="Test.setEven(true)">
</action-state>

<action-state id="odd">
<evaluate expression="Test.set(false)">
</action-state>

And please let me know is this way of implementation supports in spring webflow 2.0

Thanks in advance.

user1938073
  • 121
  • 2
  • 2
  • 9
  • Why you didn't take a look in spring webflow documentation first? Documentation for any used framework in any version is always the first place where you should take a look when you have question about simple syntax. – Łukasz Rzeszotarski Mar 16 '13 at 19:57
  • Thanks for reply.Could not find correct syntax. Can you please provide link ? – user1938073 Mar 16 '13 at 19:59

1 Answers1

8

Quoting the documentation

for decision states

<decision-state id="moreAnswersNeeded">
    <if test="interview.moreAnswersNeeded()" then="answerQuestions" else="finish" />
</decision-state>

as an alternative for

<action-state id="moreAnswersNeeded">
    <evaluate expression="interview.moreAnswersNeeded()" />
    <transition on="yes" to="answerQuestions" />
    <transition on="no" to="finish" />
</action-state>

Analogically for view states

<view-state id="uploadFile" model="uploadFileHandler">
    <var name="fileUploadHandler" class="org.springframework.webflow.samples.booking.FileUploadHandler" />
    <transition on="upload" to="finish" >
        <evaluate expression="fileUploadHandler.processFile()"/>
    </transition>
    <transition on="cancel" to="finish" bind="false"/>
</view-state>

See: http://docs.spring.io/spring-webflow/docs/2.3.4.RELEASE/reference/html/actions.html#decision-state

Łukasz Rzeszotarski
  • 5,791
  • 6
  • 37
  • 68
  • I don't know why the old link http://static.springsource.org/spring-webflow/docs/2.0.x/reference/htmlsingle/spring-webflow-reference.html#decision-state is invalid now. Cannot find documentation for the 2.0 version. – Łukasz Rzeszotarski Jun 04 '14 at 06:26