Use ternary operator in freemarker?

后端 未结 5 899
忘了有多久
忘了有多久 2021-02-01 12:54

I just want to do something like this:


5条回答
  •  后悔当初
    2021-02-01 13:28

    As of FreeMarker 2.3.23 you can write a?then('a.htm', 'b.htm'). The advantage of condition?then(whenTrue, whenFalse) over condition?string(whenTrue, whenFalse) is that it works for non-string whenTrue and whenFalse, and that it only evaluates one of whenTrue and whenFalse expressions (whichever branch is chosen).

提交回复
热议问题