grails - How to use optionKey and optionValue on g:select when passing a map -


i have list of key value pairs in controller,

list instances= [     'xxxxx':'yyyyy',     'aaaaa':'bbbbb',' ] [instances:instances] 

and in gsp

<g:select name = "sinstance" from="${instances}" optionkey="key" optionvalue ="value" /> 

but resulting error

error processing groovypageview: error executing tag : error executing tag : no such property: key class: java.lang.string

i'm looking for:

<option: value='xxxxx'> yyyyy 

like joshua moore mentioned, passing map, not list. should either fix in controller, or can call .entryset() tag:

    <g:select name="sinstance" from="${instances.entryset()}"          optionkey="key" optionvalue="value" /> 

Comments

Popular posts from this blog

javascript - RequestAnimationFrame not working when exiting fullscreen switching space on Safari -

Python ctypes access violation with const pointer arguments -