I have list of request parameters that the key is an integer, like
0=hello&1=by&2=sss .......
I want to iterate over this list of parameters using foreach
:
<c:forEach var="i" begin="0" end="${fn:length(param)-1}" >
<c:out value="${param['i']}"/>
</c:forEach>
OK, see if this trick works:
1) The c:set statement converts i from a number to a string of the form "t0, t1, t2 .."
2) Now strip off the first character, and substringAfter returns a string containing just the number.
It's super close. I believe all you need to do is remove the apostrophes:
From:
To:
With the apostrophes you are looking for a parameter named "i" instead of a parameter named "0".