freemarker if 判断list 中的元素是否为null

判断item.totalPrice 是否为null, 如果不为null 直接传递值, 为null则置0

html 复制代码
<table>
    <tr>
        <th>排名</th>
        <th>商品名</th>
        <th>成交金额</th>
    </tr>
    <#list items as item>
        <tr>
            <td>${item?index + 1}</td>
            <td>${item.name}</td>
            <td>
                <#if item.totalPrice??>
                    ${item.totalPrice}
                <#else>
                    ${0}
                </#if>
            </td>
        </tr>
    </#list>
</table>
相关推荐
大模型铲屎官7 分钟前
【Python-Day 14】玩转Python字典(上篇):从零开始学习创建、访问与操作
开发语言·人工智能·pytorch·python·深度学习·大模型·字典
yunvwugua__9 分钟前
Python训练营打卡 Day27
开发语言·python
Java致死1 小时前
设计模式Java
java·开发语言·设计模式
源码方舟1 小时前
SpringBoot + Shiro + JWT 实现认证与授权完整方案实现
java·spring boot·后端
zh_xuan1 小时前
c++ 类的语法3
开发语言·c++
2401_cf4 小时前
为什么hadoop不用Java的序列化?
java·hadoop·eclipse
帮帮志4 小时前
idea整合maven环境配置
java·maven·intellij-idea
belldeep5 小时前
如何阅读、学习 Tcc (Tiny C Compiler) 源代码?如何解析 Tcc 源代码?
c语言·开发语言
LuckyTHP5 小时前
java 使用zxing生成条形码(可自定义文字位置、边框样式)
java·开发语言·python
无声旅者7 小时前
深度解析 IDEA 集成 Continue 插件:提升开发效率的全流程指南
java·ide·ai·intellij-idea·ai编程·continue·openapi