I am having a array of name list like as shown below
[{"name": "test1"},
{"name": "test2"},
{"name": "test3"},
{"name": "test4"},
{"name": "test5"},
{"name": "test6"},
{"name": "test7"},
{"name": "test8"},
{"name": "test9"},
{"name": "test10"},
{"name": "test11"},
{"name": "test12"},
{"name": "test13"}]
What I am trying to achieve is something like a for loop as shown below but in jstl which prints the four values in each iteration
for(int i=0; i<items.size();i++)
{
System.out.println(items[i].name);
System.out.println(items[i++].name);
System.out.println(items[i++].name);
System.out.println(items[i++].name);
}
My jstl code is as given below, the code works but increment is not working within the <c:forEach>
<c:forEach var="value" items="${items}" varStatus="loopCounter">
<div class="one">{value}</div>
${loopCounter+1}
<div class="two">{value}</div>
${loopCounter+1}
<div class="three">{value}</div>
${loopCounter+1}
<div class="four">{value}</div>
</c:forEach>
Can anyone please tell me some solution for this
My expected output is like thsi
Iteration One
<div class="one">test1</div>
<div class="two">test2</div>
<div class="three">test3</div>
<div class="four">test4</div>
Iteration Two
<div class="one">test5</div>
<div class="two">test6</div>
<div class="three">test7</div>
<div class="four">test8</div>
Iteration Three
<div class="one">test9</div>
<div class="two">test10</div>
<div class="three">test11</div>
<div class="four">test12</div>
Iteration Four
<div class="one">test13</div>