Problem
I have a Java list (and I am using Java Server Pages) and I want to iterate over each element of the list in JS (so the index is the JS variable).
Obviously I cannot set the index as a variable and do this :
var v = '${object.list[' + index + '].value}'
Instead, I have to write a specific EL for each possible index.
${object.list[0].value}
${object.list[1].value}
...
This is very redundant. I only have a list of 4 elements so I can manage, but if it was 100...
Solution ?
So far I can store the EL as a string, like this :
var v = "$" + "{object.list[" + index + "].value}"
Now, can you tell me if I have any means to evaluate this string as an EL ? Like using the eval() function for example (which does not work).