怎么控制循环?

frank1197 2008-07-29 12:00:47
在画面初期化的时候,页面就想显示固定的20条记录,用这个标签能不能实现...

<%
for(int i = 0;i<20;i++) {
%>
<tr>fafafa</tr>
<% } %>

就是想用<logic:iterate>标签代替上面的代码.....
...全文
418 9 打赏 收藏 转发到动态 举报
AI 作业
写回复
用AI写文章
9 条回复
切换为时间正序
请发表友善的回复…
发表回复
jyq0105 2008-07-29
  • 打赏
  • 举报
回复
那你就给这固定的20条数据不就得了啊
lyric1812 2008-07-29
  • 打赏
  • 举报
回复
<logic:notEmpty name="lstPaper" scope="request">
<logic:iterate id="paperManage" name="lstPaper" type="cn.ujn.lunwen.manager.PaperManage" scope="request">
<tr>
<td>
<bean:write name="paperManage" property="lwzwmc" scope="page"/>
</td>
<td>
<bean:write name="paperManage" property="kwmc" scope="page"/>
</td>
<td align="center">
<bean:write name="paperManage" property="fbrq" scope="page"/>
</td>
<td align="center">
院[<bean:write name="paperManage" property="checka" scope="page"/>]
校[<bean:write name="paperManage" property="checkb" scope="page"/>]
</td>
<td>
[<a href="/lunwen/paperMng.do?method=goModifyPaperPage&PaperNo=${paperManage.lwbh}&UserId=${rybh}" target="mainFrame">修改</a>]
[<a href="/lunwen/paperMng.do?method=goDeletePaperPage&PaperNo=${paperManage.lwbh}&UserId=${rybh}" target="mainFrame">删除</a>]
</td>
</tr>
</logic:iterate>
</logic:notEmpty>
hx2044 2008-07-29
  • 打赏
  • 举报
回复
[Quote=引用 7 楼 zhangjg2124 的回复:]
加这两个属性:length="20" offset="0" offset是设置开始的位置(“0”表示第一条),你也可以设置成其他地方开始
[/Quote]
zhangjg2124 2008-07-29
  • 打赏
  • 举报
回复
加这两个属性:length="20" offset="0" offset是设置开始的位置(“0”表示第一条),你也可以设置成其他地方开始
hanyu51766 2008-07-29
  • 打赏
  • 举报
回复
用logic:iterate 里的 length offset属性来实现
skylovehang 2008-07-29
  • 打赏
  • 举报
回复
给你看个实例,自己钻研下
<logic:notEmpty name="OutListForm" property="list">
<logic:iterate name="OutListForm" property="list" id="vo"
type="com.neusoft.wms.outwarehouse.outlist.form.OutListMovementForm">
<%index++; %>
<tr>

<td nowrap=true class=singleDetailData width="25">
<input type="checkbox" name='chk'
value='<bean:write name="vo" property="rowId"/>'
id='<bean:write name="vo" property="rowId"/>' />
</td>
<td nowrap=true class=singleDetailData width="">
<bean:write name="vo" property="billNo" />
</td>
<td nowrap=true class=singleDetailData width="">
<bean:write name="vo" property="originNo" />
</td>
<td nowrap=true class=singleDetailData width="">
<bean:write name="vo" property="businessDate" />
</td>
<td nowrap=true class=singleDetailData width="">
<bean:write name="vo" property="lovName" />
</td>
<td nowrap=true class=singleDetailData width="">
<input type="hidden" name="mainstatus[<%=index%>]" id="mainstatus[<%=index%>]" value='<bean:write name="vo" property="status" />'/>
<span id="status[<%=index%>]"></span>
<script language="javascript">
<!--
var status = '<bean:write name="vo" property="status" />';
var transferstatus =( status == '0' ? "初始" :
(status == '1' ? "已下架":"已记账"));
document.getElementById("status[<%=index%>]").innerHTML=transferstatus;
-->
</script>
</td>
<td nowrap=true class=singleDetailData width="" align="right">
<bean:write name="vo" property="totalQty"/>
</td>
</tr>
</logic:iterate>
</logic:notEmpty>

估计你看的懂
Tongates 2008-07-29
  • 打赏
  • 举报
回复
<logic:iterate id="aList" name="YourForm" property="YourDataList" indexId="indexId" length="20" offset="0">

offset指定从list的那个元素开始,length指定从list中取得多少个元素
phon_oy 2008-07-29
  • 打赏
  • 举报
回复
<%
Vector animals = new Vector();
animals.addElement("Dog");
animals.addElement("Cat");
animals.addElement("Bird");
animals.addElement("Chick");
request.setAttribute("Animals", animals);
%>
<logic:iterate id="element" name="Animals">
<bean:write name="element"/><br>
</logic:iterate>

81,122

社区成员

发帖
与我相关
我的任务
社区描述
Java Web 开发
社区管理员
  • Web 开发社区
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧