如何将简单值表单 ui 表单传递给 spring webflow

How to pass simple value form ui form to spring webflow

当我提交表单时,我想发送简单的布尔值。 我不想在视图状态下为它创建特殊模型。

所以我的问题是,我可以在没有模型的情况下传递值吗,因为它是使用 spring webflow 的简单单一值。还是我必须创建模型?

你可以简单地在你的视图中使用它 myView:

<form:form action="${flowExecutionUrl}">
    <input type="checkbox" id="booleanValue" name="booleanValue"/>
    <input type="submit" id="submit" name="_eventId_submitValue" value="Submit"/>
</form:form>

在您的流程中:

<view-state id="myView">
    <transition on="submitValue">
        <set name="myBooleanValue" value="requestParameters['booleanValue']"/>
        <!-- do something with your value -->
    </transition>
</view-state>

请注意,<input type="checkbox"/> 只有在选中时才会发送值 ("on")