JSTL中c:forEach标签的varStatus问题?在线等!! items="map"这个是不是应该是items="${map}",确定了这个再说其他的。 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 <c:forEach items='${map}' var='mapItem'> <%-- Remember that items in a Hashtable don't necessarily come out in the same order they went in. --%> (<c:out value='${mapItem.key}'/> <c:out value='${mapItem.value}'/>)</c:forEach> map用key和value的键值对的形式来遍历你的这个:<c:forEach items="map" var="item" varStatus="s"> 应该是<c:forEach items="${map}" var="item" varStatus="s"> 标记里面的东西不能按照平时JSP代码那样去理解 <c:out value="${s.index}"/>按照JSP去理解的话写成<c:out value="s.index"/>就可以了, <c:out value="${item[s.index]}"/> 试下改为<c:out value="${item[${s.index}]}"/>如果不行,那就是标记不支持双层嵌套. <?xml version="1.0" encoding="UTF-8" ?><jsp:root xmlns:jsp="http://java.sun.com/JSP/Page" xmlns:c="http://java.sun.com/jsp/jstl/core" version="2.0"><html xmlns="http://www.w3.org/1999/xhtml"> <head> <title>c:forEach Example</title> </head> <body> <table> <c:forEach var="person" items="${people.people}"> <tr> <td>${person.name}</td> <td>${person.age}</td> <td>${person.height}</td> </tr> </c:forEach> </table> </body></html> <?xml version="1.0" encoding="UTF-8" ?><jsp:root xmlns:jsp="http://java.sun.com/JSP/Page" xmlns:c="http://java.sun.com/jsp/jstl/core" version="2.0"><html xmlns="http://www.w3.org/1999/xhtml"> <head> <title>c:forEach Example</title> </head> <body> <table> <c:forEach var="person" items="${people.people}" varStatus="rowCounter"> <c:choose> <c:when test="${rowCounter.count % 2 == 0}"> <c:set var="rowStyle" scope="page" value="odd"/> </c:when> <c:otherwise> <c:set var="rowStyle" scope="page" value="even"/> </c:otherwise> </c:choose> <tr class="ÃÂ${rowStyle}"> <td>${person.name}</td> <td>${person.age}</td> <td>${person.height}</td> </tr> </c:forEach> </table> </body></html> jsp弹出窗兼容性的问题 java 如何解决 OutOfMemory 在struts1.x中使用poi php程序员转jsp后工作好找吗,工资会降吗? 想实现QQ日记搬家 用JSP做脚本 暑假要做一个网络资源检索系统(网上掏宝) java Web问题 如何实现定时自动刷新页面? 求助,tomcat启动问题 线程实现快速遍历几个list取得所有组合 急问:Request.getRemoteUser为什么取得的值是null?在线等 java中如何把60多万条数据(txt文本)插入sql server2000数据库中
<c:forEach items='${map}' var='mapItem'> <%-- Remember that items in a Hashtable don't necessarily come out in the same order they went in. --%> (<c:out value='${mapItem.key}'/> <c:out value='${mapItem.value}'/>)</c:forEach>
<c:forEach items="map" var="item" varStatus="s">
应该是
<c:forEach items="${map}" var="item" varStatus="s">
<c:out value="s.index"/>就可以了,
<c:out value="${item[s.index]}"/> 试下改为<c:out value="${item[${s.index}]}"/>
如果不行,那就是标记不支持双层嵌套.
<jsp:root xmlns:jsp="http://java.sun.com/JSP/Page"
xmlns:c="http://java.sun.com/jsp/jstl/core"
version="2.0">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>c:forEach Example</title>
</head>
<body>
<table>
<c:forEach var="person" items="${people.people}">
<tr>
<td>${person.name}</td>
<td>${person.age}</td>
<td>${person.height}</td>
</tr>
</c:forEach>
</table>
</body>
</html> <?xml version="1.0" encoding="UTF-8" ?>
<jsp:root xmlns:jsp="http://java.sun.com/JSP/Page"
xmlns:c="http://java.sun.com/jsp/jstl/core"
version="2.0">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>c:forEach Example</title>
</head>
<body>
<table>
<c:forEach var="person" items="${people.people}" varStatus="rowCounter">
<c:choose>
<c:when test="${rowCounter.count % 2 == 0}">
<c:set var="rowStyle" scope="page" value="odd"/>
</c:when>
<c:otherwise>
<c:set var="rowStyle" scope="page" value="even"/>
</c:otherwise>
</c:choose>
<tr class="ÃÂ${rowStyle}">
<td>${person.name}</td>
<td>${person.age}</td>
<td>${person.height}</td>
</tr>
</c:forEach>
</table>
</body>
</html>