当我做表单提交时,我想发送简单的布尔值。我不想在视图状态下为它创建特殊模型。
所以我的问题是,我可以在没有模型的情况下传递值,因为它是使用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”)