length 属性指定需要遍历的元素的数目, 如果没有设置length 属性, 就遍历集合中的所有元素.
offset 属性指定开始遍历的起始位置, 默认值为 "0" , 表示从集合的第一个元素开始遍历.
indexId 属性定义一个代表当前遍历元素序号的变量, 这个变量被存放在 page 范围内, 可以被标签主体的<bean:write> 标签访问. 例如:
若AnimalsList为null,会返回cann't find Animals in any scope的错误.可配合<logic:notEmpty/>使用,将<logic:notEmpty></logic:notEmpty>加在<logic:iterate>外围.
offset 属性指定开始遍历的起始位置, 默认值为 "0" , 表示从集合的第一个元素开始遍历.
indexId 属性定义一个代表当前遍历元素序号的变量, 这个变量被存放在 page 范围内, 可以被标签主体的<bean:write> 标签访问. 例如:
request.setAttribute("Animals", AnimalsList); <logic:iterate id="element" // 指定输出元素的名 与 <bean:write> 中name 属性一致 indexId="index" // 遍历元素序号的变量, 这个变量放在page 范围内 name="Animals" // request 中的集合名, 从中取循环取出元素 offset="1" // 从集合的第 2 条记录开始取数 length="2"> // 取出 2 个元素 <bean:write name="index"/>// 输出每个元素的序号, 与indexId 的属性一致 <bean:write name="element"/><br> // 输出每个元素的内容, 与id 的属性一致 </logic:iterate>
若AnimalsList为null,会返回cann't find Animals in any scope的错误.可配合<logic:notEmpty/>使用,将<logic:notEmpty></logic:notEmpty>加在<logic:iterate>外围.
相关推荐
jsp脚本和<logic:iterate>标签:实现循环和分支逻辑 jsp脚本和<logic:iterate>标签:实现循环和分支逻辑 jsp脚本和<logic:iterate>标签:实现循环和分支逻辑
1. Map里存放的是bean时<br><br><logic:iterate id="destMap" name="srcMap"><br><br> <bean:define id="bean" name="destMap" property="value" /><br><br> <bean:write name="bean" property="name" /><br><br></...
DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"><br><html><br> <head><br> </head><br> <body><br> <table><br> <tr><br> <td><%@ include file="../menu.txt"%><br> </td><br> </tr>...
logic:iterate 产生问题的图
Iterate主要用来处理在页面上输出集合类,集合一般来说是下列之一: 1、 java对象的数组 2、 ArrayList、Vector、HashMap等
<logic:iterate id="tr" name="grid" indexId="index2"> <html:link action="/jsp/office/exchange/preModifyExchangeDoc" paramId="exchangeDocOID" paramName="tr" paramProperty="key"> <tr bgcolor="#ffffff...
Struts Logic标签Struts Logic标签Struts Logic标签Struts Logic标签Struts Logic标签
16.3、Logic标签 16.3.1、<logic:present>标签和<logic:notPresent>标签 16.3.2、<logic:empty>标签和<logic:notEmpty>标签 16.3.3、关系运算标签 16.3.4、<logic:iterate>标签 16.3.5、重定向标签:...
16.3、Logic标签 16.3.1、<logic:present>标签和<logic:notPresent>标签 16.3.2、<logic:empty>标签和<logic:notEmpty>标签 16.3.3、关系运算标签 16.3.4、<logic:iterate>标签 16.3.5、重定向标签:...
16.3、Logic标签 16.3.1、<logic:present>标签和<logic:notPresent>标签 16.3.2、<logic:empty>标签和<logic:notEmpty>标签 16.3.3、关系运算标签 16.3.4、<logic:iterate>标签 16.3.5、重定向标签:<logic:...
<logic:iterate id="temp" name ="list"> <tr align="center"> <td><bean:write name="temp" property="userName"/></td> <td><bean:write name="temp" property="pwd"/></td> <td><bean:...
16.3、Logic标签 16.3.1、<logic:present>标签和<logic:notPresent>标签 16.3.2、<logic:empty>标签和<logic:notEmpty>标签 16.3.3、关系运算标签 16.3.4、<logic:iterate>标签 16.3.5、重定向标签:<logic:...
16.3、Logic标签 16.3.1、<logic:present>标签和<logic:notPresent>标签 16.3.2、<logic:empty>标签和<logic:notEmpty>标签 16.3.3、关系运算标签 16.3.4、<logic:iterate>标签 16.3.5、重定向标签:<logic:...
16.3、Logic标签 16.3.1、<logic:present>标签和<logic:notPresent>标签 16.3.2、<logic:empty>标签和<logic:notEmpty>标签 16.3.3、关系运算标签 16.3.4、<logic:iterate>标签 16.3.5、重定向标签:...
16.3、Logic标签 16.3.1、<logic:present>标签和<logic:notPresent>标签 16.3.2、<logic:empty>标签和<logic:notEmpty>标签 16.3.3、关系运算标签 16.3.4、<logic:iterate>标签 16.3.5、重定向标签:...
16.3、Logic标签 16.3.1、<logic:present>标签和<logic:notPresent>标签 16.3.2、<logic:empty>标签和<logic:notEmpty>标签 16.3.3、关系运算标签 16.3.4、<logic:iterate>标签 16.3.5、重定向标签:<logic:...
NULL 博文链接:https://duqiangcise.iteye.com/blog/286764
Struts Logic标签库中包含的标签列表 Tag name Description empty 如果标签parameter,propertie等属性所指定的变量值为null或空字符串,则处理标签包含的内容 equal 如果标签parameter,propertie等属性所指定的...
struts-logic iterate标签学习指南 这标签还不错
21 // Iterate the result set, printing each column 22 // if the column was an int, we could do rs.getInt(column name here) as well, etc. 23 while (rs.next()) { 24 String id = rs.getString("country_id...