如何在速度模板中访问/获取数组/集合的大小? [英] How to access/get the size of an array/collection in velocity templates?

查看:24
本文介绍了如何在速度模板中访问/获取数组/集合的大小?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在我的 java/spring 3 应用程序中为电子邮件模板使用了速度.
如何从模板中获取添加到模型的 ArrayList 的大小.

I am using velocity for email templates in my java/spring 3 app.
How could I get the size of an ArrayList added to the model from within the template.

推荐答案

我从未使用过 Velocity,但它的 VTL 参考指南 说调用方法是使用 $customer.getAddress()${purchase.getTotal()}.所以我会使用 ${myArrayList.size()}.

I've never used Velocity, but its VTL reference guide says that calling a method is done using $customer.getAddress() or ${purchase.getTotal()}. So I would use ${myArrayList.size()}.

这篇关于如何在速度模板中访问/获取数组/集合的大小?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆