Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

And in freemarker

Tags:

freemarker

Is it possible to have and(&&) in freemarker or do I have to use a nested if?

<#if object?exists >


</#if>
like image 958
pethel Avatar asked Oct 17 '12 07:10

pethel


People also ask

What is GT in FreeMarker?

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"

What is C in FreeMarker?

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.

What language is 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.

What is the use of FreeMarker?

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.


2 Answers

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>  
like image 131
swemon Avatar answered Oct 13 '22 07:10

swemon


You can use OR logic operator

<#if color == "blue" || color == "green"> We have less than 12 things, and they are green.

like image 21
Goran Marinkovic Avatar answered Oct 13 '22 06:10

Goran Marinkovic