获取foreach循环jsp/jstl中的下一个元素
我有这样的代码:获取foreach循环jsp/jstl中的下一个元素,jsp,foreach,jstl,jsp-tags,Jsp,Foreach,Jstl,Jsp Tags,我有这样的代码: <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"> <html> <head> <meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
"http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
<title>JSTL forEach varStatus index Example</title>
</head>
<body>
<c:forEach items="${productList}" var="product" varStatus="status">
<c:out value="${status.index+1}"/>.<c:out value="${product.name}" escapeXml="false" />
</c:forEach>
</body>
</html>
现在我在任何地方都找不到答案。是否可以从下一次迭代中获得product.name,就像我在索引中添加+1一样。谁能帮我回答这个问题?谢谢。试试这个:
${productList[status.index+1].name}
${productList[status.index+1].name}