expression language, looping through arrays

I'm trying to figure out, in a jsp, how to loop through an array contained in a bean that's forwarded from a servlet to the jsp.

I can access individual array elements like so:


But I can't seem to use a variable for the array subscript. What I want to accomplish is something like this:

<% for (int i = 0; i < 10; i++){ %>
${key.myarr[<%= i %>]}
<% } %>

But it doesn't accept this way of specifying the subscript, nor several other ways I've tried it. Does anyone know how to do this?

Sign In or Register to comment.

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!