2个回答
2016-04-01 · 知道合伙人数码行家
huanglenzhi
知道合伙人数码行家
向TA提问 私信TA
知道合伙人数码行家
采纳数:117538
获赞数:517195
长期从事计算机组装,维护,网络组建及管理。对计算机硬件、操作系统安装、典型网络设备具有详细认知。
向TA提问 私信TA
关注
展开全部
jstl的foreach标签能嵌套使用,举个例子吧
<</SPAN> %
List<</SPAN> String > list = new ArrayList <</SPAN> String > ();
list.add("a");
list.add("b");
list.add("c");
List<</SPAN> String > member = new ArrayList <</SPAN> String >();
member.add("hello");
member.add("world");
request.setAttribute("list", list);
for(int i = 0 ; i <</SPAN> list.size (); i++) {
request.setAttribute("option" + i, member);
}
%>
<</SPAN> c:forEach items = "${requestScope.list}" varStatus = "status" var = "item" >
${item}的选项
<</SPAN> c:set value = "${'option'}${status.index}" var = "option" />
<</SPAN> c:forEach items = "${requestScope[option]}" var = "i" >
${i}
</</SPAN> c:forEach >
<</SPAN> br >
</</SPAN> c:forEach >
<</SPAN> %
List<</SPAN> String > list = new ArrayList <</SPAN> String > ();
list.add("a");
list.add("b");
list.add("c");
List<</SPAN> String > member = new ArrayList <</SPAN> String >();
member.add("hello");
member.add("world");
request.setAttribute("list", list);
for(int i = 0 ; i <</SPAN> list.size (); i++) {
request.setAttribute("option" + i, member);
}
%>
<</SPAN> c:forEach items = "${requestScope.list}" varStatus = "status" var = "item" >
${item}的选项
<</SPAN> c:set value = "${'option'}${status.index}" var = "option" />
<</SPAN> c:forEach items = "${requestScope[option]}" var = "i" >
${i}
</</SPAN> c:forEach >
<</SPAN> br >
</</SPAN> c:forEach >
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询