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

1 Answer

0 votes

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}">
    <c:set var="count" value="${count + 1}" scope="page" />

[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.