zoukankan      html  css  js  c++  java
  • freemarker逻辑判断写法#if

        <li class="<#if (position.flag)! =='haha1'>hide<#else >show</#if>"><a href=" ">按钮name</a></li>
        <li class="<#if (position.flag)! =='haha1'>hide</#if>"><a href=" ">按钮name</a></li>
    
        boolean 判断: class="${(obj.isShow||obj.isShow!=null)?string('disable','enable')} show"  //默认false(class="show")   //http://jxdwuao.iteye.com/blog/1037462

     <#if qqList??> : 判断这个变量是否存在;

    freemarker 判断list记录大于0:

         freemarker 判断list记录大于0 用<#if (list?size > 0)></#if>即可。下面是个显示附件的实例
        <#if (post.attachments?has_content)>
        <#if post.attachments?size gt 0>
        <#if (post.attachments?size > 0)> 
        <#else> 
        </#if>

    布尔类型判断(已自测!):

      <section  data-need="${(userListItem.isAdmin)?string('true','false')}">

  • 相关阅读:
    05-----数据类型转换
    04-----赋值运算符
    03-----数据类型
    02-----第一个JavaScript代码
    Fxx and game
    Bomb
    Stammering Aliens
    DISUBSTR
    Life Forms
    后缀数组二·重复旋律2
  • 原文地址:https://www.cnblogs.com/hahajava/p/9135119.html
Copyright © 2011-2022 走看看