Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Compare two strings in freemarker

Tags:

freemarker

I am using free marker and i am returning response from application as string i need to compare the response with static some string . Here is the way of doing. ${users.isValid} it is returning "true" in but i am not able to compare this variable form my variable.Code i am using is :

<#if ${parameters.isvalid}>
It is valid data
<#else>
It is Invalid data
</#if>

What is possible way to close this issue thanks in advance.

like image 963
venkat2010 Avatar asked Dec 17 '13 12:12

venkat2010


People also ask

How do you check for equal in FreeMarker?

Equals character: = (Supported since FreeMarker 2.3. 28.) The Code after the \x is 1 to 4 hexadecimal digits. For example this all put a copyright sign into the string: "\xA9 1999-2001" , "\x0A9 1999-2001" , "\x00A9 1999-2001" .

What is eval in FreeMarker?

eval. This built-in evaluates a string as an FTL expression. For example "1+2"? eval returns the number 3. (To render a template that's stored in a string, use the interpret built-in instead.)

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.

Does FreeMarker have content?

The has_content FunctionFreeMarker has built-in functions to detect for variables. The most common method of detecting for empty or null values uses the has_content function and the trim function. The has_content function is often used with another built-in FreeMarker function to detect for null values.


1 Answers

I have used the following syntax to compare two string values in freemarker.

<#if parameters.isvalid == "true">

like image 129
venkat2010 Avatar answered Oct 19 '22 21:10

venkat2010