velocity显示List与Map的方法详细解析
来源:互联网 发布:ubuntu命令行启动软件 编辑:程序博客网 时间:2024/06/06 17:13
http://www.jb51.net/article/40899.htm
一.遍历个map类型
1.先看后台java程序
Java代码
复制代码 代码如下:
Map<String,String> paramValues=new HashMap<String, String>();
***
*** 中间赋值操作省略了
***
data.put("paramValues", paramValues);//传值给velocity
2.前台velocity模板文件中取出这个map的key和value
Java代码
复制代码 代码如下:
#foreach($param in ${paramValues.keySet()})
<tr>
<th>$param</th>
<td>${paramValues.get($param)}</td>
</tr>
#end
二.遍历List类型
1.先看后台java代码
Java代码
复制代码 代码如下:
List<Saler> salerList=new ArrayList<Saler>();
***
***中间赋值操作省略了
***
data.put("salerList", salerList);//传值给velocity
2.再看velocity模版中代码
复制代码 代码如下:
#foreach($sal in ${salerList})
$sal.name
#end
详细出处参考:http://www.jb51.net/article/40899.htm
- velocity显示List与Map的方法详细解析
- velocity 显示List和Map方法
- velocity 显示List和Map方法
- Velocity遍历map与遍历list
- [WEB前端开发]-关于Velocity中Map与List操作-解决velocity无法识别Map对象key的问题
- velocity map list 遍历
- vector,map,list,queue的区别详细解析
- vector,map,list,queue的区别详细解析
- list,set,map,数组之间的相互转换详细解析
- Velocity遍历List和Map
- Velocity遍历List和Map
- Velocity遍历List和Map
- velocity map list 数组操作
- Velocity遍历List和Map
- java解析json与map,list相互之间的转换
- java list与数组之间的转换详细解析
- SSI与Velocity解析时的区别
- Collection List Set Map的详细分析
- 数塔
- 逆腹式呼吸法
- Python代码中中文报错问题解决
- java构造方法总结
- Bitmap内存问题
- velocity显示List与Map的方法详细解析
- mybatis generator myeclipse 插件
- 查找算法大总结
- Objective-C语法之NSArray和NSMutableArray
- 几个让你受益终生的网站---以爱丶之名
- 2014年4月操作系统份额:Windows XP仍然在26%以上,Linux微涨
- hadoop小象
- tcp 和udp的区别
- ajax提交整个from表单