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

问题描述 投票:0回答:1

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

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

java spring spring-webflow
1个回答
2
投票

你可以在你的视图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”)

© www.soinside.com 2019 - 2024. All rights reserved.