可能我写的代码很低级,请大家见谅我的水平有限,这只是我对大家一点回报。这几年遇到问题就在网上找帖子,以后把解决了的问题共享,希望对有需要的人有一点点的帮助。 <!-- 表体 --> <table width="100%" border="0" cellpadding="0" cellspacing="1" bgcolor="#758795"> <c:choose> <c:when test="${empty pager.list}"> <tr class="bg1"> <td colspan="9"> 没有符合条件的数据 </td> </tr> </c:when> <c:otherwise> <c:forEach items="${pager.list}" var="svrInfo" varStatus="vs"> <c:choose> <c:when test="${vs.count % 2 != 0}"> <tr class="bg1"> </c:when> <c:otherwise> <tr class="bg2"> </c:otherwise> </c:choose> <table> 具体请查阅JSTL的 foreach VarStatus