forEach嵌套循环的问题
程序中:
List firstList =
for(int i=; i<firstList.size(); i++) {
List secondListList =
request.setAttribute("option" + i, secondList);
}
request.setAttribute("first", firstList);
页面中:
<%int i=; %>
<c:forEach items="${first }" var="list">
${list.title }
<c:forEach items="${_____ }" var="olist">
<%i++; %>
${olist.optioni }</span>
</c:forEach>
</c:forEach>
请问我内层循环的items="${__________ }"该怎么填?
<%
List<String> list = new ArrayList<String>();
list.add("a");
list.add("b");
list.add("c"); List<String> member = new ArrayList<String>();
member.add("hello");
member.add("world"); request.setAttribute("list", list); for(int i = ; i < list.size(); i++) {
request.setAttribute("option" + i, member);
} %> <c:forEach items="${requestScope.list}" varStatus="status" var="item">
${item}的选项
<c:set value="${'option'}${status.index}" var="option" />
<c:forEach items="${requestScope[option]}" var="i">
${i}
</c:forEach> <br>
</c:forEach>
forEach嵌套循环的问题的更多相关文章
- php后台数组foreach嵌套循环
<?php foreach($list as $key=>$val){ ?> <tr class="over_odd"> <td align=& ...
- foreach嵌套循环
最近几天被这个嵌套搞晕了,还好经过几天的努力终于解决了,特记录下,因为要传两个List集合到jsp页面,还都是在一起输出,发现不能把两个集合放在一个foreach,所以就写了两个foreach来接受, ...
- php 用continue加数字实现foreach 嵌套循环中止
foreach($array as $key => $value) { if($value == 5)break; } // 这是一种. // 如果是嵌套的循环,用continue加数字也可以实 ...
- Pig FOREACH 嵌套循环
Example: Nested Block Suppose we have relations A and B. Note that relation B contains an inner bag. ...
- Mybaist 注解 foreach 嵌套循环实现批量插入
第一种写法(#使用占位符推荐): @Insert("<script>" + " insert into ${tb} " +" <fo ...
- foreach嵌套遍历循环的问题
在foreach嵌套循环中使用==和equals的问题 JSONArray ja1= new JSONArray(); JSONArray ja2 = new JSONArray(); JSONObj ...
- ThinkPHP---thinkphp视图(V)
配置文件分3类:系统配置文件,分组配置文件,应用配置文件 ①系统配置文件ThinkPHP/Conf/convention.php: ②分组 / 模块 /平台配置文件Home/Conf/config.p ...
- c:foreach如何嵌套循环,求指教,求优化
java类: public class PopedomItem { private String id; private String pid; private String name; privat ...
- mybatis map foreach遍历
mybatis map foreach遍历 转至http://www.cnblogs.com/yg_zhang/p/4314602.html mybatis 遍历map实例 map 数据如下 Map& ...
随机推荐
- bash:xxx:command not found
前几天在centos6.0上配好了oracle 10g并且能够执行oracle相关命令,但是今天准备往oracle里倒数据时,执行sqlplus 出现bash:command not found [o ...
- HttpGet()和HttpPost()
转 http://www.cnblogs.com/hyddd/archive/2009/03/31/1426026.html Http定义了与服务器交互的不同方法,最基本的方法有4种,分别是GET,P ...
- cocos2dx进阶学习之CCDirector
继承关系 CCDirecotor -> CCObject, TypeInfo 处理主窗口消息,管理何时.何种方式执行场景. 经常被翻译成导演,负责管理整个游戏的进程推动和周边支持. 成员 inl ...
- UVA 10057 A mid-summer night's dream. 仲夏夜之梦 求中位数
题意:求中位数,以及能成为中位数的数的个数,以及选择不同中位数中间的可能性. 也就是说当数组个数为奇数时,中位数就只有一个,中间那个以及中位数相等的数都能成为中位数,选择的中位数就只有一种可能:如果为 ...
- Apache JMeter - load test tool
What is it? ->>>> http://jmeter.apache.org/index.html (Please read!) Where to get it? - ...
- 瑞星杀毒软件、奇虎360杀毒软件、360卫士、百度卫士联手,搞不定弹出广告 & 恶意广告图标
一位网友说他的电脑近期出了问题:开机后桌面和任务栏上的高速启动栏会出现恶意图标.删除了下次开机又会出现:使用电脑过程中每分钟都会弹出广告.他为电脑安装了瑞星杀毒软件.奇虎360杀毒软件.360卫士.百 ...
- cygwin中vim的使用方法
vim类似Windows中的记事本,功能非常强大. vim的使用技巧 1.vim text.txt text存在则打开,不存在则类似新建一个叫text的txt文件 2.退出 按esc切换到命令模式,然 ...
- Python之路Day8
摘要: Socket编程 异常处理 线程.进程 1.socket编程 1.1 socket 三次握手,注意阻塞的应用. 1.2 socketserver(2.x写作:SocketServer) 实现多 ...
- iOS 将UIColor转换为UIImage
/** * 将UIColor变换为UIImage * **/+ (UIImage *)createImageWithColor:(UIColor *)color{ CGRect rect = CGRe ...
- QT 静态编译后中文可能会出现乱码
QT 静态编译后中文可能会出现乱码.这是因为处理文字编码的 libqcncodecs 库是以 plugin 形式存放在 QT 静态编译目录/plugs/codecs/libqcncodecs.a 文件 ...