如何在传递给select
的同时在gsp中正确使用标记ArrayList<String>
?我知道如何在我自己的组合对象中使用它,例如:
<g:select name="tablePlacesAvailable" from="${tableInfo}" optionValue="${{it.placesInTableAmount}}" optionKey="placesInTableAmount" value=""/>
但是如何将它与
built in
这样的String
对象一起使用? 最佳答案
如果要使用带有字符串列表的g:select
<g:select name="selection" from="${values}" />
其中
values
是字符串的集合。我的 Controller 代码是class DemoController {
def index() {
[values: ["This", "is", "a", "test"]]
}
}
关于grails - 在gsp中标记 “Select”,我们在Stack Overflow上找到一个类似的问题:https://stackoverflow.com/questions/30313772/