listIdx is being evaluated as the attribute value "1" then the addition + is being performed?
this is correct.
"listIdx" is not returning the attribute value "1" and that's why it fails?
also correct here.
With an array everything inside the brackets has to evaluate into a number. See the explanation in the book of David Bridgewater:
Arrays, Lists, and Maps
Suppose that I have an array defined as a page attribute
through the following scriptlet:
<% String[] dayArray = {"Mon", "Tue", "Wed", "Thu", "Fri", "Sat", "Sun"};
pageContext.setAttribute("days", dayArray); %>
An expression later in the JSP page source can access the days of the week using
syntax that is practically identical to array syntax. For example, ${days[0]}
will send 'Mon' to page output, while ${days[6]} will send 'Sun.' Within the
expressions curly braces is the name of the attribute (days) followed by square
brackets. Within the square brackets you can place any integer: either a literal or
some attribute that can be sensibly converted to an integer. So if you wrote this code
farther down the page, it would output 'Wed Thu':
<% pageContext.setAttribute("two", new Integer(2));
pageContext.setAttribute("three", "3"); %>
${days[two]}
${days[three]}
The first page attribute, called 'two,' is set to an Integer with a value of 2. So
${days[two]} gets the third value in the array 'Wed.' You can see, though, from
the second attribute, that you do not have to stick with explicit numeric types as with
java.lang.Integer. The second page attribute, called 'three,' still works when loaded
with a String. Provided that a method like Integer.parseInt() can extract an int
value from the String, everything will work.
I hope this helps,
Regards,
Frits