用于jsp标记中的每个值

时间:2018-06-14 10:59:45

标签: java jsp foreach

我在jsp页面的迭代中有一个foreach值,如图所示

<c:forEach var="lists" items="${lists}" varStatus="theCount">

String val=   ${lists.getVal() } ; //this is giving me error


</c:forEach>

1 个答案:

答案 0 :(得分:1)

https://www.tutorialspoint.com/jsp/jstl_core_set_tag.htm

<c:forEach var="list" items="${lists}" varStatus="theCount">
   <c:set var="val" value="${list.val}"/>
   <p>The value is: ${val}.</p>
</c:forEach>