用EL怎么样动态生成表格,并且表格的每一列都要有单击事件。

解决方案 »

  1.   

    <table border="1">
    <tr>
    <td>Name</td>
    <td>Age</td>
    <td>Group</td>
    </tr>
    <c:choose>
    <c:when test="${empty userlist}">
    <tr>
    <td colspan="3">没有符合条件的数据</td>
    </tr>
    </c:when>
    <c:otherwise>
    <c:forEach items="${userlist}" var="user" varStatus="vs">
    <c:choose>
    <c:when test="${vs.count % 2 == 0}">
    <tr bgcolor="red">
    </c:when>
    <c:otherwise>
    <tr>
    </c:otherwise>
    </c:choose>
    <td>
    <c:out value="${user.username}"/>
    </td>
    <td>
    <c:out value="${user.age}"/>
    </td>
    <td>
    <c:out value="${user.group.name}"/>
    </td>
    </tr>
    </c:forEach>
    </c:otherwise>
    </c:choose>

    </table>