jstl标签必须和EL表达式结合起来使用:
${}一般情况下等价于<c:out value="${}"/>,但是c:out可以使用escapeXml="true"来显示html标签
request.setAttribute("sex",1);
${sex==1?"男":"女"}
如果是数字,request.setAttribute("sex","1");也可以
<c:if test="${sex=='a'}">男</c:if>
<c:choose>
<c:when test="${sex=='aaa'}">女</c:when>
<c:otherwise>男</c:otherwise>
</c:choose>
遍历map的key和value
<c:forEach var="map" items="${map}">
${map.key}--${map.value}
</c:forEach>
遍历list
<c:forEach var="s" items="${list}">
--${s.username}--${s.age}
</c:forEach>
<c:forEach var="s" items="${smap}">
------${s.value.username}------${s.value.age}
</c:forEach>

被折叠的 条评论
为什么被折叠?



