velocity 显示List和Map方法
来源:互联网 发布:基因大数据公司 编辑:程序博客网 时间:2024/05/19 21:44
from :http://www.cnblogs.com/likwo/archive/2010/11/25/1887964.html
一.遍历个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
<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
***
***中间赋值操作省略了
***
data.put("salerList", salerList);//传值给velocity
2.再看velocity模版中代码
#foreach($sal in ${salerList})
$sal.name
#end
$sal.name
#end
0 0
- velocity 显示List和Map方法
- velocity 显示List和Map方法
- velocity显示List与Map的方法详细解析
- Velocity遍历List和Map
- Velocity遍历List和Map
- Velocity遍历List和Map
- Velocity遍历List和Map
- velocity 中Map 和List 循环
- velocity map list 遍历
- velocity map list 数组操作
- velocity获取list,map以及list套map中数据
- Velocity遍历map与遍历list
- 遍历Map和遍历List方法
- list和map集合遍历方法
- List、Set和Map的遍历方法
- groovy之list和map方法
- velocity 两种map遍历方法。
- Velocity Map
- revit api 之PostCommand用法之一
- An Introduction to Microsoft .NET Remoting Framework
- Service 上
- Java HtmlEmail 使用QQ邮箱发送邮件报错 530 Error: A secure connection is requiered(such as ssl)
- AngularJS中ng-app的赋值问题
- velocity 显示List和Map方法
- js中合并两个数组的方法
- Qt之QStringList运用
- idea15 springmvc mybatis maven 的安装,配置
- 客户端利用CXF中的JaxWsProxyFactoryBean 对webservice地址进行调用
- QListWidget
- redux在react-native中的运用
- Delphi中ClientDataSet的用法
- 博客初记