【发布时间】:2013-12-25 11:12:04
【问题描述】:
我在我的项目中使用 grails web flow 进行多形式注册过程。我创建了实现 Serializable 的命令对象。
class CustomerCommand implements Serializable{
String Name
Integer Age
Date DateOfBirth
String FatherOrHusbandName
String IdProof
String IdProofNumber
static constraints = {
}
}
我的流程部分
def customerRegisterFlow = {
enter {
action {
Customer flow.customer = new Customer()
[customer: flow.customer]
}
on("success").to("AddCustomer1")
}
AddCustomer1 {
on("next") { CustomerCommand cuscmd ->
if(cuscmd.hasErrors()) {
flash.message = "Validation error"
flow.cuscmd = cuscmd
return error()
}
bindData(flow.customer, cuscmd)
[customer: flow.customer]
}.to("AddCustomer2")
}
}
现在我面临两个问题。
1) 当我单击下一步按钮时,hasErrors() 函数没有正确验证表单输入值。它只是重定向到 AddCustomer2 页面。它也接受空白值。
2) 我无法访问视图页面 (GSP) 中的流范围对象。当我单击 AddCustomer2 中的后退按钮时,这是必需的,它应该显示具有用户已经从流程范围输入的值的页面
<input type="text" class="input" name="Name" value="${customer?.Name}"/>
这是我在 AddCustomer1 中的输入字段。请帮助我解决这个您可能已经面临的问题。提前致谢
【问题讨论】:
标签: grails spring-webflow grails-2.0 grails-plugin grails-controller