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>
相关推荐
冷雨夜中漫步5 小时前
Python快速入门(6)——for/if/while语句
开发语言·经验分享·笔记·python
JH30736 小时前
SpringBoot 优雅处理金额格式化:拦截器+自定义注解方案
java·spring boot·spring
m0_736919107 小时前
C++代码风格检查工具
开发语言·c++·算法
Coder_Boy_8 小时前
技术让开发更轻松的底层矛盾
java·大数据·数据库·人工智能·深度学习
2501_944934738 小时前
高职大数据技术专业,CDA和Python认证优先考哪个?
大数据·开发语言·python
invicinble8 小时前
对tomcat的提供的功能与底层拓扑结构与实现机制的理解
java·tomcat
较真的菜鸟8 小时前
使用ASM和agent监控属性变化
java
黎雁·泠崖8 小时前
【魔法森林冒险】5/14 Allen类(三):任务进度与状态管理
java·开发语言
2301_763472469 小时前
C++20概念(Concepts)入门指南
开发语言·c++·算法
TechWJ9 小时前
PyPTO编程范式深度解读:让NPU开发像写Python一样简单
开发语言·python·cann·pypto