如何使用SpringWeblow提交表单
下面是我从jsp&flowxml中提取的代码片段,在尝试提交表单时,我的页面正在刷新,但请求不会发送到服务器。请帮忙如何使用SpringWeblow提交表单,spring,forms,spring-webflow,Spring,Forms,Spring Webflow,下面是我从jsp&flowxml中提取的代码片段,在尝试提交表单时,我的页面正在刷新,但请求不会发送到服务器。请帮忙 Jsp <form action="${flowExecutionUrl}" modelAttribute="employeeDto" method="post"> <div class="formButton"> <input type="hidden" name="_flowExecutionKey" value="${flowExec
Jsp
<form action="${flowExecutionUrl}" modelAttribute="employeeDto" method="post">
<div class="formButton">
<input type="hidden" name="_flowExecutionKey" value="${flowExecutionKey}" />
<input name="_eventId_nextBtn" type="submit" value="submit">
</div>
</form>
Flow xml
<flow xmlns="http://www.springframework.org/schema/webflow" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://www.springframework.org/schema/webflow http://www.springframework.org/schema/webflow/spring-webflow-2.4.xsd">
<var name="employeeDto" class="com.school.transferobjects.EmployeeDto"/>
<view-state id="employeeView" model="employeeDto" view="employee">
<transition on="nextBtn" to="createEmployee" />
</view-state>
<action-state id="createEmployee">
<evaluate
expression="employeeHelper.saveEmployee(flowRequestContext,employeeDto)"
result="flowScope.res"/>
<transition on="${flowScope.res.success=='success'}" to="student.do"/>
</action-state>
</flow>
Jsp
流xml
我认为eventId未被识别,因此当您单击按钮提交时,找不到eventId,导致流执行得到刷新。
确保包含表单标记:
<%@ taglib prefix="form" uri="http://www.springframework.org/tags/form"%>
<form:form modelAttribute="yourModel" method="post">
...
</form:form>
...
我也尝试添加此标记,但都是徒劳的,主要是因为,如果我用代码替换标记,那么我认为其他东西会产生问题。问题是其中一个导入,问题解决了。