Using variables in #{select} tag attributes
I have a page in my app with a dynamically-generated form, in which I need a number of <select>
elements. Since I don't know in advance how many there will be, I need to put an ID number in the name
attribute of each <select>
. I'm trying to use the built-in #{select}
tag (documentation here) like so:
#{ select 'select_' + ${IDnum}}
...options, etc...
#{/select}
When I do that I get a MissingMethodException:
No signature of method: Template_1009.$() is applicable for argument types:
(Template_1009$_run_closure1_closure2_closure3) values:
[Template_1009$_run_closure1_closure2_closure3@ad2388] Possible solutions:
_(java.lang.String), is(java.lang.Object), run(), run(), any(), get(java.lang.String).
When I instead do:
#{ select 'select_${IDnum}'}
the page renders correctly, but the select element renders like this in view-source:
<select name="select_${IDnum}" size="1" >
So开发者_高级运维, how do I get the value of ${IDnum}
into the name attribute? I can do this with normal HTML <select>
tags, but I'll need to write some Javascript to emulate Play's value:${x}
functionality that I really don't want to bother with.
Thanks!
Try this :
#{select 'select_'+IDNum}
精彩评论