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& ...
随机推荐
- Basic REST API Design
- pragma comment
pragma指令简介 在编写程序的时候,我们经常要用到#pragma指令来设定编译器的状态或者是指示编译器完成一些特定的动作. 下面介绍了一下该指令的一些常用参数,希望对大家有所帮助! 一. mess ...
- 数据结构——二叉树(Binary Trees)
非线性数据结构 二叉搜索树(Binary Search Tree) 树的密度=结点数/高度 二叉树类 #pragma once class stnode { public: int nodeValue ...
- victim是什么意思_victim在线翻译_英语_读音_用法_例句_海词词典
victim是什么意思_victim在线翻译_英语_读音_用法_例句_海词词典 victim
- PIGS(最大流)
PIGS Time Limit: 1000MS Memory Limit: 10000K Total Submissions: 18742 Accepted: 8511 Description ...
- (Problem 21)Amicable numbers
Let d(n) be defined as the sum of proper divisors of n (numbers less than n which divide evenly into ...
- AppStore安装APP发生错误解决方法
打开网络偏好设置 高级 -> DNS -> + -> 114.114.114.114
- linux下java窗口,正确显示中文
Tip1 1.在 JAVA_HOME/jre/lib/fonts/ 下建立个目录 fallback 2.在 fallback 里弄个中文字体最简单ln一下就好了 比如: ln -s /usr/shar ...
- win7删除桌面文件需要刷新才会消失(2种解决方法)
有没有遇到过这种情况,删除桌面文件没有效果,要点右键的刷新删除过的文件才会在桌面上消失!解决方法有两种: 第一种方法 点击"开始→运行",在对话框中输入"regedit& ...
- 【BZOJ1132】【POI2008】Tro 计算几何 叉积求面积
链接: #include <stdio.h> int main() { puts("转载请注明出处[辗转山河弋流歌 by 空灰冰魂]谢谢"); puts("网 ...