这个问题快把我逼疯了。
我有以下视图状态:
<on-start>
<evaluate expression="new com.zxxztech.zecure.services.webflow.FormularioConfirmacionCorreo()"
result="flowScope.ccForm" />
</on-start>
<view-state id="activacionManual" model="ccForm" >
<transition on="enviar" to="resultado" bind="true">
<evaluate expression="usersManager.activarUsuario(ccForm.correo, ccForm.codigo)"
result="flowScope.resultado" />
</transition>
<transition on="cancelar" to="cancelar" validate="false" bind="false" />
</view-state>
这就是 Validation 类:
@Component
public class FormularioConfirmacionCorreoValidator {
@Autowired
private UsersManager usersManager;
public void validateActivacionManual(FormularioConfirmacionCorreo ccForm, ValidationContext validContext) {
...
[Validation logic]
}
public UsersManager getUsersManager() {
return usersManager;
}
public void setUsersManager(UsersManager usersManager) {
this.usersManager = usersManager;
}
}
提交表单时,webflow 直接执行 <evaluate> 标签,不调用验证方法。
我不知道我做错了什么。
编辑:
这是activacionManual.jsp文件:
...
<form:form cssClass="ym-form" modelAttribute="ccf" method="post" action="${flowExecutionUrl}">
<form:errors cssClass="ym-error" element="div" path="*"/>
<div class="ym-box">
<div class="ym-fbox">
<label for="correo"><spring:message
code="activacion.form.correo.label"
text="activacion.form.correo.label" /></label>
<form:input path="correo" />
</div>
<div class="ym-fbox">
<label for="codigo"><spring:message
code="activacion.form.codigo.label"
text="activacion.form.codigo.label" /></label>
<form:input path="codigo" />
</div>
<div class="ym-fbox-footer ym-fbox-button">
<input class="ym-button ym-gr" type="submit"
value="<spring:message code="formulario.button.cancelar" text="formulario.button.cancelar" />"
name="_eventId_cancelar">
<input class="ym-button ym-primary ym-gr" type="submit"
value="<spring:message code="formulario.button.enviar" text="formulario.button.enviar" />"
name="_eventId_enviar">
</div>
</div>
</form:form>
...