谁懂做struts2的jsp页? 懂的话帮忙解释下代码:<table width="100%" border="1" cellpadding="2" cellspacing="0" bordercolor="#BBBBBB" id="table1">
<tr class="TableHeader">
<c:if test="${not empty TABLE_HEAD}">
<c:forEach var="head" items="${TABLE_HEAD}" varStatus="index">
<td height="20" align="center" ><c:out value="${head}"/></td>
</c:forEach>
</c:if>
</tr>
<c:if test="${not empty TABLE_DATA}">
<c:forEach var="curRecord" items="${TABLE_DATA}" varStatus="index">
<tr id='t1' onmouseout="mOut(this);" onmouseover="mOver(this);" style="CURSOR: hand">
<c:forEach var="v" items="${curRecord}" varStatus="status">
<c:choose>
<c:when test="${status.index == 0}">
<td height="20" width="20">
<input type="radio" name="radRecord" onclick="record_onclick('${v}')"/>
</td>
</c:when>
<c:otherwise>
<td align="center"><c:out value="${v}"/></td>
</c:otherwise>
</c:choose>
</c:forEach>
</c:forEach>
</c:if> </table>
<tr class="TableHeader">
<c:if test="${not empty TABLE_HEAD}">
<c:forEach var="head" items="${TABLE_HEAD}" varStatus="index">
<td height="20" align="center" ><c:out value="${head}"/></td>
</c:forEach>
</c:if>
</tr>
<c:if test="${not empty TABLE_DATA}">
<c:forEach var="curRecord" items="${TABLE_DATA}" varStatus="index">
<tr id='t1' onmouseout="mOut(this);" onmouseover="mOver(this);" style="CURSOR: hand">
<c:forEach var="v" items="${curRecord}" varStatus="status">
<c:choose>
<c:when test="${status.index == 0}">
<td height="20" width="20">
<input type="radio" name="radRecord" onclick="record_onclick('${v}')"/>
</td>
</c:when>
<c:otherwise>
<td align="center"><c:out value="${v}"/></td>
</c:otherwise>
</c:choose>
</c:forEach>
</c:forEach>
</c:if> </table>
用到的是jstl标准标签库,楼主你去查下jstl标准标签库怎么使用就知道这段代码的意思了。例如:<c:forEach var="curRecord" items="${TABLE_DATA}" varStatus="index">
这个是循环标签,遍历items属性指定的集合。
给段if和for嵌套的java代码你不会看不懂吧.?
既然进来了就给个参考答案吧
拿一段来说吧
<c:if test="${not empty TABLE_HEAD}">//判断TABLE_HEAD是否为空,TABLE_HEAD是action里面request.setAttribute("TABLE_HEAD",值);过来的...不为空就循环
//相当于java代码里的if(request.getAttribute("TABLE_HEAD")!=null)
<c:forEach var="head" items="${TABLE_HEAD}" varStatus="index">//相当于java代码里的for(X head :TABLE_HEAD){}X表示TABLE_HEAD里保存元素的类型 varStatus在这没用到,可以去掉 <td height="20" align="center" ><c:out value="${head}"/>//输出每个元素的值了</td>
</c:forEach>更多的请参考jstl和el资料