forEach迭代列表与整数
整数迭代
<!-- 简单示例 --> <c:forEach var="i" begin="1" end="10" step="1"> <c:out value="${i}" /> </c:forEach> <!-- 传入变量 --> <c:forEach var="i" begin="1" end="$(totalPage)" step="1"> <c:out value="${i}" /> </c:forEach>
列表迭代
<!-- experts是个List<Map>--> <c:forEach items="${experts}" var="expert" varStatus="status" begin="0" end="9"> <tr> <td>${status.index+1}</td> <td><img src="${expert.headImagePath}"/></td> <td>${expert.expertName}</td> <td>${expert.phone}</td> <td>${expert.address}</td> <td>${expert.expertIntroduction}</td> <td>${expert.createTime}</td> <td data-expertid="${expert.expertID}"> </tr> </c:forEach>
参数说明
items 被迭代的列表(迭代整数时不用设置)
begin 开始的元素(0=第一个元素,1=第二个元素)
end最后一个元素(0=第一个元素,1=第二个元素)
step每次迭代的步长
var 当前条目的变量名称
varStatus 循环状态的变量名称(可以获取序列号)
2020年11月21日 18:57
i read a lot of stuff and i found that the way of writing to clearifing that exactly want to say was very good so i am impressed and ilike to come again in future.. sagame66
2020年11月21日 19:14
Thank you because you have been willing to share information with us. we will always appreciate all you have done here because I know you are very concerned with our. marijuana seeds
2020年11月22日 19:56
One present why galore businesses opt for postcards is because they are overmuch cheaper to be prefab and this can forbear a lot of expenses on the lengthened run. 먹튀검증
2020年11月24日 19:51
This is very educational content and written well for a change. It's nice to see that some people still understand how to write a quality post.! Arabic majlis sofa
2020年11月26日 21:36
If you don"t mind proceed with this extraordinary work and I anticipate a greater amount of your magnificent blog entries. CBD Nugs
2020年12月17日 01:49
Your article is extremely helpful exceptionally fascinating subject i am looking that sort of post thank for imparting to us keep it up. parc clematis price
2020年12月21日 21:33
Interesting post. I Have Been wondering about this issue. so thanks for posting. Pretty cool post.It 's really very nice and Useful post.Thanks the avenir
2020年12月24日 20:34
Interesting post. I Have Been wondering about this issue. so thanks for posting. Pretty cool post.It 's really very nice and Useful post.Thanks ryse residences condo
2021年1月11日 19:26
It is my first visit to your blog, and I am very impressed with the articles that you serve. Give adequate knowledge for me. Thank you for sharing useful material. I will be back for the more great post. 먹튀검증사이트
2023年8月20日 20:27
Gclub has emerged as a prominent player in the rapidly evolving online entertainment landscape, offering a diverse range of casino games, live dealer experiences, and more. Whether you're a seasoned gambler or a casual player seeking thrilling experiences, Gclub provides a platform that caters to all tastes. สมัคร เล่นจีคลับ