2012-09-21 71 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)