简体   繁体   中英

Grails: g:render pass data

I'm having problems to pass data through g:render to another view, which is included in printme.gsp

printme.gsp:

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

input1/_form.gsp:

<!-- Here there is no value set -->
<g:textArea maxlength="1000" name="number" value="${input1Instance?.number}"/>

How can I pass the Object from printme.gsp to input/_form.gsp?

Thanks.

You must pass the data as model explicitly:

<g:render contextPath="../input1" template="form" model="[input1Instance:input1Instance]"/>

then you can access it from template

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM