Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/scala/17.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Templates Grails动态更新模板属性_Templates_Grails_Plugins - Fatal编程技术网

Templates Grails动态更新模板属性

Templates Grails动态更新模板属性,templates,grails,plugins,Templates,Grails,Plugins,我在gsp页面中有以下g:render标记: <g:render template="/artist/rate" model='[artistID: 1, rating: 5]' /> 但很快我意识到它不起作用,因为从gsp页面生成的html不包含g:render标记,因为它在呈现插件时会被替换 有没有办法做到这一点? 非常感谢。您需要一个控制器来确定要渲染的模型的值,然后将更新/更改的模型传递给gsp render标记 控制器应该负责将正确的模型传递给视图,所以在视图中执行 &l

我在gsp页面中有以下g:render标记:

<g:render template="/artist/rate" model='[artistID: 1, rating: 5]' />
但很快我意识到它不起作用,因为从gsp页面生成的html不包含g:render标记,因为它在呈现插件时会被替换

有没有办法做到这一点?
非常感谢。

您需要一个控制器来确定要渲染的模型的值,然后将更新/更改的模型传递给gsp render标记

控制器应该负责将正确的模型传递给视图,所以在视图中执行

<div id="artist${artistID}">
   <richui:rating dynamic="true" id="${artistID}" units="5" rating="${rating}"  controller="rating" action="rate"  />   
</div>
$(g:render).attr('model','[artistID: 1, rating: 3]')