How to get all the values from a Groovy Map in a select of a GSP page

grails, groovy, gsp

Solution

<g:select  from="${mostBeautifulCities.entrySet()}" name="city"  optionKey="key" optionValue="value" ></g:select>

Problem

Let's say we have a map like: ``` def mostBeautifulCities = [ cadiz : "Cádiz", KeyForCity2 : "some value for city2" ] ``` How could we list all values? (I did not find a easy way looking at the Groovy JDK documentation). I want to show all values in a select control: ``` <g:select id="city" name="city" from="${ mostBeautifulCities.(...) }" noSelection="${['':'Select a ugly city...']}" /> ```

Original source