如何在速度模板中检索哈希图值 [英] How to retrieve hashmap values in velocity template
本文介绍了如何在速度模板中检索哈希图值的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
如何从速度模板中的以下哈希图中检索值?请帮忙..
How to retrieve values from the following hashmap in velocity template? Please help..
LinkedHashMap<String, LinkedHashMap<Integer, Object>> hashmap = new LinkedHashMap<String, LinkedHashMap<Integer,Object>>();
推荐答案
首先,将 hashmap 添加到您的支持 Java 类(参考 此处).
First, add the hashmap to your backing Java class (reference here).
context.put("myhashmap", hashmap);
然后您可以引用在您的 Velocity 模板中的任何位置,例如:
Then you can reference anywhere in your Velocity template, e.g:
<span>$myhashmap.get("foo").get(1).toString()</span>
这篇关于如何在速度模板中检索哈希图值的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文