Choose When and Otherwise : Choose « JSTL « Java Tutorial

<%@ taglib uri="" prefix="c" %>
<%@ taglib uri="" prefix="c-rt" %>
    <title>Count to 10 Example(tracking even and odd)</title>

    <table border="0">
      <c:forEach var="i" begin="1" end="10" varStatus="status">
        <jsp:useBean id="status" type="javax.servlet.jsp.jstl.core.LoopTagStatus" />

          <c-rt:when test="<%=status.getCount()%2==0%>">
            <c:set var="color" value="#eeeeee" />

            <c:set var="color" value="#dddddd" />

          <td width="200" bgcolor="<c:out value="${color}"/>"> 
          <c:out value="${i}" />
  Download: 1,225 k)

24.5.1.Tag Examples - choose
24.5.2.Combine If Chooser to Report Exception
24.5.3.Choose XML Data with Comparision
24.5.4.Choose When Statement
24.5.5.Choose When and Otherwise