如何在传递给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/

10-11 07:11
查看更多