jstl遍历集合

<table style=" border: 1px solid black">
    <thead><td>id</td><td>名称</td><td>价格</td></thead>
     //通过域对象获取从action里面获得的集合,el表达式${} var="item"是设置变量
     //item相当于一个对象,对象.属性就是获取相关的值
    <c:forEach items="${applicationScope.list}" var ="item">
        <tr>
            <td>${item.goodid}</td>
            <td>${item.goodname}</td>
            <td>${item.goodprice}</td>
        </tr>
        <br>
    </c:forEach>
</table>

猜你喜欢

转载自blog.csdn.net/W_violet/article/details/84642805