rss
twitter

Wednesday, May 11, 2011

Greater than comparison in Freemarker tags

In Freemarker we can test the lesser than condition directly  .
<#if value1 < valu2>
    value1 is less than value2
 </#if>

But we can't do the same for greater than (>) in freemarker tag like

//Wrong method
<#if value1 > valu2>
    value1 is greater than value2
 </#if>

The above one is wrong because the first occurrence of  > sign will close the <#if condition. so for this we need to use either one of the following methods

 Correct Method 1:
 <#if (value1 > value2)> 
   value1 is greater than value2
 </#if>

Correct Method 2:

 <#if value1  &gt; value2>
   value1 is greater than value2
 </#if>

Bookmark and Share

1 comments:

Anonymous,  October 24, 2014 at 1:03 AM  

Your post has saved me. Thank you!

Post a Comment

  © Blogger templates by Ourblogtemplates.com updated with zenplate.com tips

Back to TOP