I have a problem with PlayFramework 1.2.5 and my question is:
How can I use a variable that be assigned by a #set{…/} tag into a #{if …/} tag?
This is my java code – (it works):
...
renderArgs.put("blockInsert", true);
...
And this is my htm code – (it works):
...
#{set allowInsert:"${!blockInsert}" /}
...
Reading variables with ${} and #{get/} – (it works):
blockInsert == ${blockInsert}<br/>
allowInsert == #{get 'allowInsert' /}<br/>
Using variables on #{if/} tag – (it not works well):
using variable from renderArgs - (it works)
#{if blockInsert}
cant't insert
#{/if}
#{else}
can insert
#{/else}
<br/>
using variable from #{set} tag - (it not works)
#{if allowInsert}
can insert
#{/if}
#{else}
cant't insert
#{/else}
...
When I run this page the output is:
blockInsert == true
allowInsert == false
using variable from renderArgs - (it works) cant't insert
using variable from #set} tag - (it not works) can insert
use
instead of set.
The Result of the set tag is a String. Or you adjust the if statement: