我想在一页上呈现相同的模板,该模板应根据参数值(3或4)显示该值。
View 是-
<td >
<g:render template="gdxqStatusTemplate" model="[param:3]" /> </td>
</td>
<td> </td>
<td >
<g:render template="gdxqStatusTemplate" model="[param:4]" /> </td>
</td>
Controller 具有-
[ total3:totalValue3,total4:totalValue4]
如何在模板代码中显示合计的适当值-
<table >
<tr ><td class="InputText" nowrap><b> MessageQ Status,/td>
<tr> <td class="NoLight" nowrap>Total MessageQ : ${total+params}***/* IT SHOWS "total4" NOT THE VALUE.*/***
</td></tr>
<tr height=30></tr>
</table>
最佳答案
您必须更改:
<g:render template="gdxqStatusTemplate" model="[param:3]" />
通过 <g:render template="gdxqStatusTemplate" bean="${total3}" />
并在模板中替换: <td class="NoLight" nowrap>Total MessageQ : ${total+params}</td>
创建人: <td class="NoLight" nowrap>Total MessageQ : ${it}</td>
对于文档检查:http://grails.org/doc/2.0.x/ref/Tags/render.html
关于templates - 如何根据传递的模型参数值来呈现模板值?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/10033453/