Reputation: 121
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.
Upvotes: 3
Views: 12928
Reputation: 6130
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
Upvotes: 8