<c:forEach var = "cart" items= "${cartx.items}">
<tr bgcolor="${(i%2) ? "#EFF3FB" : "White" }">
<td><c:out value = "${cart.key.tilte }"/></td>
<td><c:out value = "${cart.key.price }"/><开发者_如何学Python/td>
<c:set var = "price" value="${price}"></c:set>
<c:set var="i" value = "${i+1 }"/>
</tr>
</c:forEach>
in this code snippet i want to access cartx which is a session variable and it contains list of book objects where book is a class.
i want to print the title and price of book which are the members of book class.
Maps are accessed in JSTL like that: ${map[key]}
. (if key
is an attribute as well)
精彩评论