我从我的控制器传递数据:controller.groovy
render(view: "printme", model: [patient: patient, behandlungInstance: behandlung, frage1Instance: frage1]);
到 printme.gsp 和从 printme.gsp :
<g:render contextPath="../frage1" model="['frage1Instance':frage1Instance]" template="form"/>
到 frage1/_form.gsp。
当我写作
render(view: "printme", model: [patient: patient, behandlungInstance: behandlung, frage1Instance: frage1]);
一切正常,“frage1”的输入字段被预填,但是当我写的时候
render(view: "printme", model: [patient: patient, behandlungInstance: behandlung,
frage1Instance: frage1, frage2Instance: frage2]);
“frage1”的输入字段不会被预填充。
更新:frage1/_form.gsp 示例
<div class="fieldcontain ${hasErrors(bean: frage1Instance, field: 'sub1', 'error')} required">
<label class="rm_pre" for="sub1">
<g:message code="frage1.sub1.label_pre" default="Sub1" />
</label>
<g:radioGroup name="sub1" values="[-3,-2,-1,1,2,3]" disabled="${session.disabled }" value="${frage1Instance?.sub1}" >
<span style="padding-left: 5px; padding-right: 5px">${it.radio}</span>
</g:radioGroup>
<label class="rm_post" for="sub1">
<g:message code="frage1.sub1.label_post" default="Sub1" />
</label>
</div>
这里有什么问题?
谢谢 :)