jstl 标签 的应用

时间:2021-09-25 01:50:08

参考文档:http://www.yiibai.com/jsp/jstl_core_choose_tag.html

1.jstl中foreach序号

<c:forEach items="${signBusList}" var="sign" varStatus="xh">

${xh.count}序号从1开始

${xh.index}序号从0开始

${xh.last}最后一个序号

${xh.first}第一个序号

</cforEach>

2.foreach 循环

jstl 标签 的应用
	                <tbody>
<c:if test="${!empty analysisList}">
<c:forEach var="o" items="${analysisList}" varStatus="status">
<c:choose>
<c:when test="${empty o.maclist}">
<tr class="text-c">
<td>${status.index + 1}</td>
<td width="36" height="36">${o.positionName }</td>
<td width="36" height="36">${o.imsi }</td>
<td width="36" height="36">${o.datetime }</td>
<td width="36" height="36"></td>
<td width="36" height="36"></td>
<td width="36" height="36"></td>
</tr>
</c:when>
<c:when test="${!empty o.maclist}">
<c:forEach var="maclist" items="${o.maclist}"
varStatus="status1">
<tr class="text-c">
<td>${status.index + 1}</td>
<td width="36" height="36">${o.positionName }</td>
<td width="36" height="36">${o.imsi }</td>
<td width="36" height="36">${o.datetime }</td>
<td width="36" height="36">${maclist.mac }</td>
<td width="36" height="36">${maclist.capture_time }</td>
<td width="36" height="36">${status1.count}</td>
<%-- <td width="36" height="36">${status1.last}</td> --%>
</tr>
</c:forEach>
</c:when>
</c:choose>
</c:forEach>
</c:if>
</tbody>

  jstl 标签 的应用

request.setAttribute("email", email);
<select
id="isemail" name="isemail" style="width: 230px;height: 30;">
<option value="${email}" ${email =="是"?"selected='selected'" :""} >是</option>
<option value="${email}" ${email =="否"?"selected='selected'" :""} >否</option>
</select>