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>
相关推荐
小Ti客栈4 小时前
Spring Boot 集成 Springdoc-OpenAPI 与 Knife4j实现接口文档与可视化调试
java·spring boot·后端
互联网中的一颗神经元4 小时前
小白python入门 - 39. 采集流水线小项目
开发语言·python
Wang's Blog4 小时前
Go-Zero 项目开发22:用户群聊功能的实现与完善
开发语言·golang
Ai拆代码的曹操5 小时前
Spring 事务 REQUIRES_NEW 嵌套调用:连接池翻倍的秘密
java·后端·spring
a1117765 小时前
坦克大战3D Three.js 3D (开源项目)
开发语言·javascript·3d
动恰客流统计5 小时前
ReID边缘计算视觉统计:餐饮店客流增长的数字化破局路径
java·大数据·运维·人工智能
Ivanqhz6 小时前
Rust &‘static str浅析
java·前端·javascript·rust
Wang's Blog7 小时前
Go-Zero项目开发24: 基于Bitmap实现群聊消息已读未读
开发语言·后端·golang
weixin_419658319 小时前
Docker 搭建 Jenkins 服务
java·docker·jenkins
captain3769 小时前
多线程线程安全问题
java·java-ee