0 votes
3.3k views
in JSTL by
How to break a foreach loop in jstl ?

1 Answer

0 votes
by

You take a variable in your jsp page and set value in that variable. To <s:set> to set value in that variable which scope is page only.

You use the following code in according to your requirement.

<c:set var="count" value="0" scope="page" />
<c:forEach items="${employees}" var="domain">
  <c:if test="${count < 6}">
    ${domain.departmentName}
    <c:set var="count" value="${count + 1}" scope="page" />
  </c:if>
</c:forEach>

[Note:- "employees" is list of employee domain data]

Share:- Whatsapp Facebook Facebook


Welcome to Developerhelpway Q&A, where you can ask questions and receive answers from other members of the community.

Categories

...