JSTL日期格式化

forEach迭代列表与整数

妙音 posted @ 2014年11月06日 11:18 in java with tags jstl;迭代 , 2539 阅读

整数迭代

<!-- 简单示例 -->
<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 循环状态的变量名称(可以获取序列号)
 
Avatar_small
sagame66 说:
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

Avatar_small
marijuana seeds 说:
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

Avatar_small
buy soma 500 说:
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. 먹튀검증

Avatar_small
Arabic majlis sofa 说:
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

Avatar_small
CBD Nugs 说:
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

Avatar_small
luxury homes carmel 说:
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

Avatar_small
the avenir 说:
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

Avatar_small
ryse residences cond 说:
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

Avatar_small
먹튀검증 说:
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. 먹튀검증사이트

Avatar_small
Hibbah 说:
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. สมัคร เล่นจีคลับ


登录 *


loading captcha image...
(输入验证码)
or Ctrl+Enter