借助bboss标签库提供的list标签,我们可以非常方便地实现列表中的动态列数据的展示。
假设现在list中存放的是map类型的记录,map中有部分key/value是确定的,有部分key是不固定的,同时会把这不固定的列的key放在另一个list里,这样在遍历第一个list中的map数据时,直接输出固定的key/value数据后,再通过结合存放动态key的list来循环输出这些动态的key/value数据。
bboss在cell标签中提供了usecurrentCellValuetoCellName和currentcelltoColName两个属性来支撑这个功能特性。
usecurrentCellValuetoCellName为cell标签特有属性,功能说明:与index标签结合使用,usecurrentCellValuetoCellName对应当前list的当前记录的属性名称,将这个属性对应的值作为index索引对应的外围容器对象记录的属性名称,cell标签输出这个名称对应的外围记录的属性值
currentcelltoColName为cell标签特有属性,为boolean类型,默认为false,为true时标识生效,功能说明:与index标签结合使用,currentcelltoColName标识将当前list的当前记录对应的对象作为index索引对应的外围容器对象记录的属性名称,cell标签输出这个名称对应的外围记录的属性值。
currentcelltoColName属性适用于List<String>场景,也就是说将key直接存储在List中。usecurrentCellValuetoCellName适用于List<PO>类型,也就是说key作为PO对象的一个属性,然后这个PO对象存放在List中。
下面的代码演示了两个属性的使用方法:
<%
List rooms = new ArrayList();
for (int i =0 ; i < 10; i ++) {
Map map=new HashMap();
map.put("rommType", "麻将室"+i);
map.put("rommTypeID", "mj"+i);
map.put("overNum", (100+i)+"");
for (int j = 0; j < 10 ; j ++) {//设置动态属性
map.put("day "+j+"剩余房间数:", (10+j)+"");//map增加时间段内的数据
}
rooms.add(map);
}
List<String> days=new ArrayList<String>();
for (int j = 0; j < 10 ; j ++) {
days.add("day "+j+"剩余房间数:");
}
List<RoomDay> roomDays=new ArrayList<RoomDay>();
for (int j = 0; j < 10 ; j ++) {
RoomDay roomDay = new RoomDay();
roomDay.setDay("day "+j+"剩余房间数:");
roomDays.add(roomDay);
}
request.setAttribute("rooms", rooms);
request.setAttribute("days", days);
request.setAttribute("roomDays", roomDays);
%>
<div>
<p>currentcelltoColName属性演示</p>
<div>
<pg:list requestKey="rooms">
<p> <pg:cell colName="rommType"/></p>
<p><pg:cell colName="rommTypeID"/></p>
<p><pg:cell colName="overNum"/></p>
<p><pg:list requestKey="days">
<p><pg:cell/><pg:cell index="0" currentcelltoColName="true"/></p>
</pg:list></p>
</pg:list>
</div>
</div>
<div>
<p>usecurrentCellValuetoCellName属性演示</p>
<div>
<pg:list requestKey="rooms">
<p><pg:cell colName="rommType"/></p>
<p><pg:cell colName="rommTypeID"/></p>
<p><pg:cell colName="overNum"/></p>
<p><pg:list requestKey="roomDays">
<p><pg:cell colName="day"/><pg:cell index="0" usecurrentCellValuetoCellName="day"/></p>
</pg:list></p>
</pg:list>
</div>
</div>
参考文档:
bboss中的map标签结合list标签/cell标签展示复杂数据结构案例
分享到:
相关推荐
bboss-datatran 由 bboss 开源的数据采集&流批一体化工具,提供数据采集、数据清洗转换处理和数据入库以及数据指标统计计算流批一体化处理功能。
bboss会话共享培训文档,学习bboss不可多得的资料,值得拥有。
bboss es特点请访问: https://www.oschina.net/p/bboss-elastic
bboss-datatran 由 bboss 开源的数据采集&流批一体化工具,提供数据采集、数据清洗转换处理和数据入库以及数据指标统计计算流批一体化处理功能。 同时也是一个高性能Elasticsearch orm 客户端,100%兼容es各个版本 ...
企业级 J2EE 开源框架:bboss
弹性Tran老板数据交换模块使用文档: : Bboss是一个很好的Elasticsearch Java Rest客户端。 它运行并访问像mybatis这样的elasticsearch来关联数据库。环境要求JDK要求:JDK 1.7+ Elasticsearch版本要求:1.X,2.X,5...
bboss+es基本操作示例,elasticsearch,bboss,java使用demo
NULL 博文链接:https://yin-bp.iteye.com/blog/301119
springboot集成ElasticsearchBboss调用Elasticsearch的案例分享
NULL 博文链接:https://yin-bp.iteye.com/blog/2325602
官方版本,亲测可用
NULL 博文链接:https://yin-bp.iteye.com/blog/926166
本bboss-datatran项目基于Java开发,包含591个文件,包括Java源代码、...系统实现了数据采集、数据清洗转换处理、数据入库以及数据指标统计计算的流批一体化处理功能,界面友好,功能完善,适合用于数据采集与处理。
Elasticsearch rest client bboss介绍-Elastic2018中国开发者大会演讲稿
资源目录: 项目源码(eshelloword.rar) bboss elasticsearch开发入门教程.wmv 搭建bboss elasticsearch开发环境.wmv 说明.txt
NULL 博文链接:https://yin-bp.iteye.com/blog/2174863
NULL 博文链接:https://yin-bp.iteye.com/blog/2177475
浙江移动BBOSS系统快速入门手册V0.1归类.pdf
在不断的实践过程中,越来越多的好东西被吸纳到bboss这个大家庭中,使得bboss能够更好地应用于企业应用项目中,能够更好地解决开发过程中碰到的实际问题。基于bboss,可以快速地开发构建稳定、高效、健壮、可扩展的...
NULL 博文链接:https://yin-bp.iteye.com/blog/1131637