Search code examples
javajspjstl

Convert java looping into JSTL <c:forEach>


I used java, and i want to convert it into jsp using c:forEach

 int supplierList = 40;
 for (int a = 0; a < supplierList ; a++) 
 {

 }

Here is my java code screenshoot


Solution

  • <c:forEach items="${bean.getFunctions()}" var="func"> <c:if test="${func.key=='Search'}"> </c:if> </c:forEach>

    in here bean.getFunctions() will return a map. When looping each element will assign to var.