jsp循环遍历后台List结果的三种常用方法
来源:互联网 发布:php打表格 编辑:程序博客网 时间:2024/06/06 03:06
第一种:struts1.2循环遍历元素,name是结果集。引用标签库<%@ taglib uri="http://struts.apache.org/tags-logic" prefix="logic" %>
[java]
<logic:iterate id="x" name="alluser">
<tr>
<td>${x.u_id }</td>
<td>${x.u_name }</td>
<td>${x.u_sex }</td>
<td><a href="${pageContext.request.contextPath }/user.do?method=one&u_id=${x.u_id }">修改</a></td>
<td><a href="${pageContext.request.contextPath }/user.do?method=del&u_id=${x.u_id }">删除</a></td>
</tr>
</logic:iterate>
第二种:struts2.0循环遍历元素,注:value是结果集。引用标签库<%@ taglib uri="/struts-tags" prefix="s" %>
[java]
<s:iterator value="allemp" status="all">
<tr>
<td><s:property value="#all.getIndex()+1"/> </td>
<td>${EId }</td>
<td>${EName }</td>
<td>${TDept.PName }</td>
<td>
<s:if test="#this.ESex==1">男</s:if>
<s:else>女</s:else>
</td>
<td>${ELove }</td>
<td><a href="${pageContext.request.contextPath }/emp!one.action?e_id=${EId }">修改</a></td>
<td><a href="${pageContext.request.contextPath }/emp!del.action?e_id=${EId }">删除</a></td>
</tr>
</s:iterator>
第三种:serlvet用<c:>标签循环遍历,注:items是结果集。引用标签库<%@ taglib prefix="c" uri="/WEB-INF/c.tld" %>
[java]
<c:forEach var="x" items="${all}">
<tr>
<td id="title" colspan="2">标题:${x.n_title }</td>
</tr>
<tr>
<td colspan="2">作者:${x.n_user }td>
</tr>
</c:forEach>
- jsp循环遍历后台List结果的三种常用方法
- jsp循环遍历后台List结果的三种常用方法
- jsp循环遍历后台List结果的三种常用方法
- Jsp遍历后台传过来的List三种方法
- Jsp遍历后台传过来的List
- Jsp遍历后台传过来的List
- Jsp遍历后台传过来的List
- Jsp遍历后台传过来的List
- JSP遍历后台传过来的List
- 遍历list的三种方法
- JAVA LIST的三种遍历方法
- 遍历List的三种方法
- 遍历list的三种方法
- 遍历List集合的三种方法
- java遍历List的三种方法
- list 三种的遍历方法
- 遍历List集合的三种方法
- 遍历List集合的三种方法
- ios 带推送服务的证书的申请与不带此服务的区别
- opencv 图像的边缘
- 用牛顿迭代法求根号2及sqrt(任意数),连续求解,保留小数点后16位
- fastcv 2 —— fastcorner例子浅析
- POJ3259 Wormholes 解题报告--bellman_ford
- jsp循环遍历后台List结果的三种常用方法
- could not complete schema update
- memcpy函数的实现.strcpy函数
- LeetCode-Trapping Rain Water
- 复制构造函数应该注意的问题
- Xcode如何编译Debug版和Release版
- LeetCode-First Missing Positive
- RCP: 代码方式设置View为不可关闭样式
- C语言循环输入字符串#结束写入文件