내 프로젝트에서 다중 형식 등록 프로세스를 위해 grails 웹 플로우를 사용하고 있습니다. Serializable을 구현하는 command 객체를 만들었습니다.Grails 명령 객체의 유효성이 확인되지 않았습니다.
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.validation.Validateable
class CustomerCommand implements Serializable{
답장을 보내 주셔서 감사합니다 ... 동일한 코드 집합을 사용했지만 명령 개체의 이름을 지정하는 데 혼란을 겪고 있습니다 ... 잠깐 설명해 주시겠습니까 ...? – Prasath
나는 나의 대답을 업데이트했다 – unekwu
고마워.하지만 전반적으로 하위 플로우를 포함한 세부 설명에서 적절한 튜토리얼을 얻지 못했다. 나는 전자 책을 가지고있다 ...하지만 그것은별로 도움이되지 않는다. – Prasath