1

Is there a way to write this Java code as pure JSTL?

    for(int g = 0; g < eval.getCriterionGroupCount(); g++{
        //processing
        for(int c = 1; c < eval.getGroups().get(g).getCriterionCount() + 9; c++){
         //processing
        }
    }
  • eval is an instance of a class
  • getCriterionGroupCount returns an int
  • getGroups returns an ArrayList
  • getCriterionCount returns an int

1 Answer 1

6

Here you go

 <c:forEach var="g" begin="0" end="${eval.criterionGroupCount}" step ="1">

   <c:forEach var="c" begin="1" end="${eval.groups[g].criterionCount + 9}" step ="1">

   </c:forEach>    

 </c:forEach>

Assuming eval is available through pageContext/request/session/servletContext

0