JSTL core标签库
</c:if>
if you need the process is similar to if ... else, it should be use <c:choose> tag.
<c:when test="${condition}">
// TODO
</c:when>
<c:otherwise>
// TODO
</c:otherwise>
</c:choose>
for(int num=2;num<=100;num=num+2){}
<c:forEach var="num" begin="2" end="100" step="2">
// TODO
</c:forEach>
b) traversal List:
for(Object person:personList){
person.getId();
person.getName();
person.getAge();
...
}
<c:forEach items="${personList}" var="person">
<tr>
<td>${person.id}</td>
<td>${person.name}</td>
<td>${person.age}</td>
...
</tr>
</c:forEach>
c) traversal Map:
<c:forEach var="item" items="${Map}">
<tr>
<td>${item.key}</td>
<td>${item.value}</td>
</tr>
</c:forEach>
d) Attribute: varStatus
varStatus="varStatus" begin="1" end="7" step="2">
<tr>
<td>${varStatus.index}</td>
<td>${item}</td>
</tr>
</c:forTokend>
Result:
1 AA
3 CC
5 EE
7 GG
1. <c:out>
<c:out value="${param.action}"></c:out>2. <c:if>
<c:if test="${param.action=='contion'}"></c:if>
if you need the process is similar to if ... else, it should be use <c:choose> tag.
3. <c:choose>、 <c:when>、 <c:otherwise>
<c:choose><c:when test="${condition}">
// TODO
</c:when>
<c:otherwise>
// TODO
</c:otherwise>
</c:choose>
4. <c:forEach>
a) normal round:for(int num=2;num<=100;num=num+2){}
<c:forEach var="num" begin="2" end="100" step="2">
// TODO
</c:forEach>
b) traversal List:
for(Object person:personList){
person.getId();
person.getName();
person.getAge();
...
}
<c:forEach items="${personList}" var="person">
<tr>
<td>${person.id}</td>
<td>${person.name}</td>
<td>${person.age}</td>
...
</tr>
</c:forEach>
c) traversal Map:
<c:forEach var="item" items="${Map}">
<tr>
<td>${item.key}</td>
<td>${item.value}</td>
</tr>
</c:forEach>
d) Attribute: varStatus
5. <c:forTokend>
<c:forTokend items="AA,BB,CC,DD,EE,FF,GG" delime"," var="item"varStatus="varStatus" begin="1" end="7" step="2">
<tr>
<td>${varStatus.index}</td>
<td>${item}</td>
</tr>
</c:forTokend>
Result:
1 AA
3 CC
5 EE
7 GG