假设我们有一张地图:
def mostBeautifulCities =
[
cadiz : "Cádiz",
KeyForCity2 : "some value for city2"
]
Run Code Online (Sandbox Code Playgroud)
我们如何列出所有值?(我没有找到一个简单的方法来查看Groovy JDK文档).
我想在select控件中显示所有值:
<g:select id="city" name="city"
from="${ mostBeautifulCities.(...) }"
noSelection="${['':'Select a ugly city...']}" />
Run Code Online (Sandbox Code Playgroud)
<g:select from="${mostBeautifulCities.entrySet()}" name="city" optionKey="key" optionValue="value" ></g:select>
Run Code Online (Sandbox Code Playgroud)