如何计算速度模板中列表的大小?

How to calculate the size of list in a velocity template?

如何计算速度模板中的列表大小?我正在使用速度 1.4。

List<String> list = new ArrayList<String>();

list.size() "Return with list size value Datatype 'Integer'"

我假设你的意思是 "how do you call java methods in in the velocity template" 因为你正在寻找的方法在 "List" javadoc 上,已经提到了。

我相信这篇文章会有所帮助:

How to access/get the size of an array/collection in velocity templates?

为了节省阅读时间,您应该可以输入以下内容:

${myArrayList.size()}