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]