为什么forEach会失效

来源:百度知道 编辑:UC知道 时间:2024/05/03 10:31:27
<table width="730" height="130" border="0" cellpadding="0" cellspacing="0" id="table65">
<tbody>
<tr>
<td id="demo1"><table id="table66" cellspacing="0" cellpadding="0" width="730" border="0">
<tbody>

<tr>
<c:forEach items="hotelList" var="h">

<td><table id="table67" cellspacing="0" cellpadding="0" width="142"
border="0">

<c:forEach items="hotelList" var="h">
items="${hotelList}"

引入
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>

<c:forEach>&条件标签使用2008-05-26 10:33<c:forEach>标签的使用

在JSP的开发中,迭代是经常要使用到的操作。例如,逐行的显示查询的结果等。在早期的JSP中,通常使用Scriptlets来实现Iterator或者Enumeration对象的迭代输出。现在,通过JSTL的迭代标签可以在很大的程度上简化迭代操作。

JSTL所支持的迭代标签有两个,分别是<c:forEach>和<c:forTokens>。在这里介绍的是<c:forEach>标签。

简单点说,<c:forEach>标签的作用就是迭代输出标签内部的内容。它既可以进行固定次数的迭代输出,也可以依据集合中对象的个数来决定迭代的次数。

<c:forEach>标签的语法定义如下所示。

<c:forEach var="name" items="expression" varStatus="name"

begin="expression" end="expression" step="expre