So basically I want Index to increase at run time while the for loop is executing. In the above case although the Index increases but does not reflect in the for loop.
How can I achieve this in JSP. Any kind of help will be much appreciated. Thanks in advance.
So if I understand this right, while looping through your items you can add more to your list?
Using this syntax the end index would be evaluated at the start of the loop.
It would not get re-evaluated every time through, so modifying the value $Index wouldn't change the amount of iterations.
I can't think of any way to do this with JSTL syntax directly.
One hacky workaround I can think of would be to implement an Iterator that has this functionality, and invoke the forEach tag referencing the iterator.