The syntax is wrong indeed. Details.
A correct syntax one be "${someVar} gt 6"
but of course, it will not work correctly, although the template will render. That is because ${someVar}
evaluates to 12 (for example) while ${someVar} gt 6
evaluates to true
. These are not equal.
If you enable the ThyemeLeaf trace you will see how thymeleaf will interpret this:
o.t.s.expression.GreaterThanExpression : Evaluating GREATER THAN expression: "${someVar} > 6". Left is "12", right is "6". Result is "true"
o.t.s.expression.EqualsExpression : Evaluating EQUALS expression: "${someVar} == (${someVar} > 6)". Left is "12", right is "true". Result is "false"
Depending on the logic which you want to implement you may come to very different solutions - e.g. from putting a gadget in your model to implementing if-else logic. Check this question for some more ideas.