[struts2]jstl标签用法技巧

时间:2022-04-20 14:06:31

1.<c:if test="${var} != null"></c:if>

2.

  <c:foreach var="singleVar" items="" varStatus="states"></c:foreach>

  <c:if test="${states.index%2=0}"></c:if>

  <c:if test="${states.index%2=1}"></c:if>

  <c:if test="${states.last}"></c:if>

3.

<c:choose>

<c:when test="${empty param.username}">

Nnknown user.

</c:when>

<c:when test="${param.username=='Tom'}">

${param.username} is manager.

</c:when>

<c:otherwise>

${param.username} is employee.

</c:otherwise>

</c:choose>