Is it possible to have and(&&) in freemarker or do I have to use a nested if?
<#if object?exists >
</#if>
vars["in"] ), since they are keywords in FTL: true : boolean value "true" false : boolean value "false" gt : comparison operator "greater than" gte : comparison operator "greater than or equivalent"
c (when used with numerical value) This built-in converts a number to string for a "computer language" as opposed to for human audience. That is, it formats with the rules that programming languages used to use, which is independent of all the locale and number format settings of FreeMarker.
FreeMarker is a template engine, written in Java, and maintained by the Apache Foundation. We can use the FreeMarker Template Language, also known as FTL, to generate many text-based formats like web pages, email, or XML files.
Apache FreeMarker™ is a template engine: a Java library to generate text output (HTML web pages, e-mails, configuration files, source code, etc.) based on templates and changing data.
You can use && as logical operator in free maker. See Logical operations
For example
<#if x < 12 && color = "green">
We have less than 12 things, and they are green.
</#if>
<#if !hot> <#-- here hot must be a boolean -->
It's not hot.
</#if>
You can use OR logic operator
<#if color == "blue" || color == "green"> We have less than 12 things, and they are green.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With