With Spring Webflow 2, what request parameters, if any, are necessary to trigger “submit” transition from view-state?
-
04-07-2019 - |
Question
My view-state to action-state transition does not appear to be happening. In the following example, I want the view-state to transition to the action-state when the user submits the form. Pretty basic stuff. But the setA()
method does not get called.
In the jsp, does the submit input
element need to have a name of "_
eventId", or "_
eventId_
submit", or is no name necessary? Or is something else wrong? What is webflow checking against when evaluating the on
attribute of transition
element?
<flow ... start-state="stateA">
<var name="flowBean" class="demo.webflow.WebFlowBean" />
<view-state id="stateA" view="fooView">
<transition on="submit" to="changeA" />
</view-state>
<action-state id="changeA">
<evaluate expression="flowScope.flowBean.setA(requestParameters.value)" />
...
</action-state>
JSP:
<form action="demo.htm" name="myform" id="myform" method="post">
<input type="hidden" name="_flowExecutionKey" value='<c:out value="${flowExecutionKey}"/>'/>
<input type="submit" name="????" value="Continue"/>
Solution
Found the problem, I think. I removed the action
attribute from my form
, and now everything works:
<form name="myform" id="myform" method="post">
I'm guessing that, by having that action
URL in there, somehow I was restarting the flow with each submit.
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow