Topic: 求助怎么使用iterator标签?

  Print this page

1.求助怎么使用iterator标签? Copy to clipboard
Posted by: loveolala
Posted on: 2003-06-19 15:02

我有以下一段代码,已经保存了数据,其中user是一个javabean:
ArrayList myList = new ArrayList();
user = new User(1,"mike");
myList.add(user);
user = new User(2,"tom");
myList.add(user);
request.setAttribute("testlist",myList);

我如何使用iterator循环显示myList中的值?
<logic:iterator “这儿属性怎么写????????”>
????
</logic:iterator>

2.Re:求助怎么使用iterator标签? [Re: loveolala] Copy to clipboard
Posted by: lihongtao
Posted on: 2003-06-19 17:30

<logic:iterator name='testlist' id='user'>
<html:text property='name' name='user'/>
....
</logic:iterator>

3.Re:求助怎么使用iterator标签? [Re: lihongtao] Copy to clipboard
Posted by: fhk1999
Posted on: 2003-06-30 13:23

lihongtao wrote:
<logic:iterator name='testlist' id='user'>
<html:text property='name' name='user'/>
....
</logic:iterator>


Should be:
<logic:iterator name='testlist' id='user'>
<bean:write property='name' name='user'/>
....
</logic:iterator>

4.Re:求助怎么使用iterator标签? [Re: loveolala] Copy to clipboard
Posted by: robin
Posted on: 2003-07-03 09:35

建议使用model 2x!比较灵活也比较简单!

5.Re:求助怎么使用iterator标签? [Re: robin] Copy to clipboard
Posted by: haibo
Posted on: 2003-07-28 18:52

robin wrote:
建议使用model 2x!比较灵活也比较简单!

model 2x ---------什么意思?

6.Re:求助怎么使用iterator标签? [Re: loveolala] Copy to clipboard
Posted by: lihongtao
Posted on: 2003-07-31 09:19

对呀,什么意思?
还有可以使用jstl:
<c:forEach var="user" items="${requestScope.testlist}">
<c:out value="${user.name}" />
....
</c:forEache>


   Powered by Jute Powerful Forum® Version Jute 1.5.6 Ent
Copyright © 2002-2021 Cjsdn Team. All Righits Reserved. 闽ICP备05005120号-1
客服电话 18559299278    客服信箱 714923@qq.com    客服QQ 714923