首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >Grails: g:渲染过程数据

Grails: g:渲染过程数据
EN

Stack Overflow用户
提问于 2013-05-29 06:11:21
回答 1查看 4.6K关注 0票数 2

在通过g:render传递数据到另一个视图时遇到了问题,该视图包含在printme.gsp中

printme.gsp:

代码语言:javascript
复制
<h1>abc</h1>
${input1Instance?.number} <!-- Here I can see the right value -->
<g:render contextPath="../input1" template="form"/>

input1/_form.gsp:

代码语言:javascript
复制
<!-- Here there is no value set -->
<g:textArea maxlength="1000" name="number" value="${input1Instance?.number}"/>

如何将对象从printme.gsp传递到input/_form.gsp?

谢谢。

EN

回答 1

Stack Overflow用户

回答已采纳

发布于 2013-05-29 06:16:42

您必须将数据作为模型显式传递:

代码语言:javascript
复制
<g:render contextPath="../input1" template="form" model="[input1Instance:input1Instance]"/>

然后,您可以从模板中访问它

票数 7
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/16802340

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档