2013-03-16 78 views
2

如下执行了switch语句。如何在spring webflow中实现Switch/if else语句?

如果有任何问题,请您确认并纠正它吗?

<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> 

并请让我知道是实现这种方式支持在春季Webflow的2.0

在此先感谢。

+0

为什么你没有先看看spring webflow文档?任何版本的任何已使用框架的文档始终是您对简单语法存在疑问时应首先查看的地方。 – 2013-03-16 19:57:15

+0

感谢您的答复。无法找到正确的语法。你能提供链接吗? – user1938073 2013-03-16 19:59:58

回答

5

报价决策状态的文档

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

作为替代用于

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

类推为视图状态

<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> 

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

+0

我不知道为什么现在旧链接http://static.springsource.org/spring-webflow/docs/2.0.x/reference/htmlsingle/spring-webflow-reference.html#decision-state无效。找不到2.0版本的文档。 – 2014-06-04 06:26:36