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>
相关推荐
沛沛老爹几秒前
Web开发者突围AI战场:Agent Skills元工具性能优化实战指南——像优化Spring Boot一样提升AI吞吐量
java·开发语言·人工智能·spring boot·性能优化·架构·企业开发
Full Stack Developme3 分钟前
Redis 实现主从同步
java·redis·spring
一只爱学习的小鱼儿4 分钟前
在QT中使用饼状图进行数据分析
开发语言·qt·数据分析
yangminlei5 分钟前
Spring Boot 响应式 WebFlux 从入门到精通
java·spring boot·后端
曹轲恒10 分钟前
SpringBoot配置文件
java·spring boot
亓才孓22 分钟前
[认识异常和错误]java
java·开发语言
码农水水29 分钟前
中国电网Java面试被问:流批一体架构的实现和状态管理
java·c语言·开发语言·面试·职场和发展·架构·kafka
1***438037 分钟前
C++跨平台开发的核心挑战线程管理等基础功能
开发语言·c++
做萤石二次开发的哈哈39 分钟前
萤石开放平台 萤石可编程设备 | 设备脚本自定义开发
开发语言·python·萤石云·萤石·萤石开放平台