c forEach 如何迭代数组 "c forEach "如何迭代数组. 如何将 list 中保存的 数组 迭代出来...? 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 没太看明白你的意思,是迭代还是遍历,是遍历list,找出其中的数组,还是遍历数组中的每个元素?遍历数组和list类似 <% String[] words = { "foo", "bar", "baz"}; pageContext.setAttribute("words", words); %> <%@ taglib prefix="c" uri="http://java.sun.com/jstl/core" %> <H2>Key Words:</H2> <UL> <c:forEach var="word“ items="${words}"> <LI><c:out value="${word}"/> </c:forEach> </UL> 将list中的数组中的元素迭代出来. 嘿嘿... action:request.setAttribute("mylist",list);jsp:<c:forEach items="${mylist}" var="user"> ${user.name} ${user.xxx}</<c:forEach> 就像三楼的那样 ,items里面放list,var里放的是每次取出的结果,然后通过var里的对象 .(点)出来你要的东东,就行了。 <c:forEach items="${productlist}" var="product" varStatus="status"> <tr> <input name="product_id" type="hidden" value="${product.id}"/> <td class=tablebody2 valign=middle align=center width="">${status.count}</td> <td class=tablebody1 valign=middle width=""> <a href="${pageContext.request.contextPath }/product/manager/toDetail.do?product_id=${product.id }">${product.name }</a></td> <td class=tablebody2 valign=middle align=center width="">${ product.basePrice}</td> <td class=tablebody1 valign=middle align=center width=""><a href="${pageContext.request.contextPath }/cart/manager/add.do?product_id=${product.id }"> <img border="0" src="${pageContext.request.contextPath }/images/car_new.gif" width="97" height="18"></a> </td> </tr> </c:forEach> 一个读取xml问题!! 批处理程序为什么在有的 服务器上运行不了 大家来看看这个警告是怎么回事? 请问谁有java写的打印功能源码吗? 一个关于DIV的问题 (紧急求救,谢谢你们了) 急!如何远程启动tomcat应用服务以及Oracle数据库 数据库问题? 之前学习java知识的时候,一直不知道stringbuffer和string的区别 SUN的NetBeans 4.1(有多少人用?) java初学者关于HIBERNATE的提问 求教高手如何监控Tomcat连接池中的连接状态? oracle中date类型字段,为什么两台电脑上的hibernate转换的类型不一样?
pageContext.setAttribute("words", words);
%>
<%@ taglib prefix="c" uri="http://java.sun.com/jstl/core" %>
<H2>Key Words:</H2>
<UL> <c:forEach var="word“ items="${words}">
<LI><c:out value="${word}"/> </c:forEach>
</UL>
request.setAttribute("mylist",list);jsp:
<c:forEach items="${mylist}" var="user">
${user.name}
${user.xxx}
</<c:forEach>
然后通过var里的对象 .(点)出来你要的东东,就行了。
<tr>
<input name="product_id" type="hidden" value="${product.id}"/>
<td class=tablebody2 valign=middle align=center width="">${status.count}</td>
<td class=tablebody1 valign=middle width=""> <a href="${pageContext.request.contextPath }/product/manager/toDetail.do?product_id=${product.id }">${product.name }</a></td>
<td class=tablebody2 valign=middle align=center width="">${ product.basePrice}</td>
<td class=tablebody1 valign=middle align=center width=""><a href="${pageContext.request.contextPath }/cart/manager/add.do?product_id=${product.id }">
<img border="0" src="${pageContext.request.contextPath }/images/car_new.gif" width="97" height="18"></a> </td>
</tr>
</c:forEach>