2012-09-21 45 views
4

我在调用控制器函数时必须呈现选择。在控制器中呈现Grails标记

class FormController { 
    def document() { 
     render """<g:select name="tipo" from="${['','one','two']}" />""" 
    } 
} 

它不工作..在HTML出现没事的时候我替换此功能的股利。

回答

6

使用tag as method call语法来代替:

render g.select(name:"tipo" from:['','one','two']) 
+0

感谢:'渲染(文字:g.select(名称:从 “TIPO”:[ '', '一', '二']) )' – IgniteCoders

0
//Build your output string as the next: 
def output = g.select(name:"tipo" from:['','one','two']) 
//And add any other string or tag if you need 
output = "Tipo: " + output 
render (text: output)