简体   繁体   English

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

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

How to calculate list size in velocity template? 如何计算速度模板中的列表大小? I am using velocity 1.4. 我正在使用速度1.4。

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

I assume that you mean "how do you call java methods in in the velocity template" because the method you are looking for is on the "List" javadoc, already mentioned. 我假设您的意思是“如何在速度模板中调用Java方法”,因为您要查找的方法在“ List” javadoc中,已经提到过。

I believe this article would be helpful: 我相信这篇文章会有所帮助:

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

To save you a read, you should just be able to input this: 为了节省您的阅读,您应该只能输入以下内容:

${myArrayList.size()} $ {myArrayList.size()}

list.size()“以列表大小值数据类型'Integer'返回”

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM