来源:http://honda418.javaeye.com/blog/354821
传递一个Map类型到vm页面,然后从vm渲染Map,把结果显示出来!
Java代码
Map<Long, String> map = new HashMap<Long, String>();
map.put(100000L, "aaaaa");
map.put(100001L, "bbbbb");
map.put(100002L, "ccccc");
vm页面代码:
Velocity代码
#foreach($key in $map.keySet())
$!map.get($key)
#end
此时遍历后能正确输出结果。
-----------------------------------------------------------------------------------------------------------------------------------------------------
如果我现在不想遍历,只需要得到其中一个确定的value:
Velocity代码
$!map.get(100000)
或者
Velocity代码
$!map.get("100000")
此时都不能得到我想要的结果。
-----------------------------------------------------------------------------------------------------------------------------------------------------
问题出在原始的Map类型Long上面,修改代码如下:
Java代码
Map<Integer, String> map = new HashMap<Integer, String>();
map.put(100000, "aaaaa");
map.put(100001, "bbbbb");
map.put(100002, "ccccc");
Velocity代码
$!map.get(100000)
或者
Java代码
Map<String, String> map = new HashMap<String, String>();
map.put("100000", "aaaaa");
map.put("100001", "bbbbb");
map.put("100002", "ccccc");
Velocity代码
$!map.get("100000")
都能得到正确结果。
看来velocity对Long的支持有点问题。
同样,对Short、Float、Double也有同样的问题。
保险期间,建议用String。。。。。
相关推荐
NULL 博文链接:https://liuzidong.iteye.com/blog/1308261
以下是对velocity显示List与Map的方法进行了详细的介绍。需要的朋友可以过来参考下
springMVC引入谷歌地图附java、velocity代码,内附源码以及静态页面
We also propose a novel IMU initialization method, which computes the scale, the gravity direction, the velocity, and gyroscope and accelerometer biases, in a few seconds with high accuracy....
Map and other Map Representations………………………………………………59 3.6.1 Comparative Experiments on Navigation Efficiency……………………59 3.6.2 Performance Comparison of Map Maintenance and ...
Scala集合和选项可在foreach指令中使用允许以财产表示法访问Scala的公共成员允许以$ map ['key']之类的格式访问Scala Maps如何使用通过更改Velocity.properties的设置进行应用时在velocity.properties中指定的...
Intense-laser-induced above-threshold ionization of a bound... The velocity map of the liberated electron exhibits the well-known low-energy structure as well as other features off the polarization axis.
. Hadoop是大数据的核心技术之一,而Nutch集Hadoop之大成,是Hadoop的源头。学习Hadoop,没有数据怎么办?...Volume数据体量巨大,Variety数据类型繁多,Value价值密度低,商业价值高,Velocity处理速度快。
Spring MVC 框架简介 Spring Web model-view-controller (MVC)框架是围绕 DispatcherServlet 设计的,并分发请求到处理程序...模型map被转化为合适的格式,如JSP request attributes或是 Velocity template model。
####################引用数据库与函数###################### import pygame from random import ... global bird,velocity, gravity, bird_wing_down, bird_wing_up, frame, map_width, map_height, FPS, pipes
sheer Volume, Variety and Velocity. Most of this data is unstructured, quasi structured or semi structured and it is heterogeneous in nature. The volume and the heterogeneity of data with the speed it...
麦哲伦探险家210更新 German grid fix regarding accuracy of position New Swedish grid for SWEREF99 New Map management : ...VMG (velocity made good) added to information selected on configurable fields
% M_QUIVER Makes a quiverplot on a map (QUIVER-style) % M_QUIVER(LONG,LAT,U,V) plots velocity vectors as arrows with components % (U,V) at the points (LONG,LAT) on the currently defined map. The % ...
This book takes you through the journey of building a modern data lake architecture using HDInsight, a Hadoop-based service that allows you to successfully manage high volume and velocity data in the ...
It's like velocity, has own tags, but these tags is written in excel file. By these tags, you can custom your excel report format freely, not edit any your source, just ExcelUtils parses your excel ...
Volume数据体量巨大,Variety数据类型繁多,Value价值密度低,商业价值高,Velocity处理速度快。 Hadoop是大数据的核心技术之一,而Nutch集Hadoop之大成,是Hadoop的源头。学习Hadoop,没有数据怎么办?用Nutch抓!...
单选题 1) 大数据的4V特点:Volume、Velocity、Variety、Veracity,其中他们的含义分别是( 1 )、( 2 )、( 3 )、( 4 )。 A.价值密度低 B.处理速度快 C.数据类型繁多 D.数据体量巨大 2) 大数据技术的战略意义...