我有2个豆子:
class GroupVisitReconfirmation {
int visitorsNumber
static belongsTo = [
groupVisitRequest: GroupVisitRequest
]
static constraints = {
visitorsNumber nullable: false, validator: { val, obj, errors ->
def visitorsNumber = obj.groupVisitRequest.visitorsNumber
}
}
}
class GroupVisitRequest extends VisitRequest {
static hasOne = [
groupVisitReconfirmation: GroupVisitReconfirmation
]
}
我也有这样的形式用于GroupVisitReconfirmation:
<g:form action="completeReconfirmation" params="${params.frame ? [frame: '✓'] : [:]}" novalidate="novalidate">
<fieldset class="form">
<field:wrapper bean="${bean}" field="visitorsNumber">
<g:render template="reconfirmation/textField" />
</field:wrapper>
</fieldset>
</g:form>
我如何传递此形式的GroupVisitRequest?因为当我现在这样做时,我在约束中有Null Pointer Exception。