Quick PlayFramework / Groovy
Why does the following code always emit 'yes' (in HTML) even when sel
has a different value other than 'audio'? (I've logged the values of sel
and confirmed different values.)
This is my day 1 on Play. So, I may be doing something really stupid.
${sel='a开发者_Python百科udio'?'yes':'no'}
I don't know the Groovy templates that well, but I think it should be like this:
${sel=='audio'?'yes':'no'}
Your code:
${sel='audio'?'yes':'no'}
means; if 'audio' (a string that is not null will always be "true") then sel = 'yes' otherwise 'no', so it will never be 'no'.
You might want to look at the yesNo extension: http://www.playframework.org/documentation/1.2.1/javaextensions#yesNo
精彩评论