tomcat-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Geoff Simonds <GSimo...@loomissayles.com>
Subject Accessing Array element while iterating through Map
Date Mon, 14 Jun 2004 17:29:20 GMT
I am trying to iterate through a Map and use the key from the map to 
access an element in a separate array.   I have an array of data points 
and only want to display the entries that are specified in a separate Map. 
 Here is a snippet:

<logic:iterate id="years" name="years_Map">
        <bean:define id="year" name="years" property="key" />
        <td><bean:write name="product" property='<%= "annualizedReturns[" 
+ year + "].performance" %>' /></td>
</logic:iterate>

The Map contains data that looks like this:
        "1", "1 yr"
        "2", "2 yr"
        "5", "5 yr" 
        etc...

Whe the page is rendered, it draws a bit of the page and the remainder of 
the page remains blank.  I can't find any log entry to indicate that any 
errors are being thrown.  If I print out the results of <%= 
"annualizedReturns[" + year + "].performance" %> between <td>, I get the 
correct value ( ie, annualizedReturns[1].performance) and when I replace 
the property attribute in the bean:write tag above with 
"annualizedReturns[1].performance" hardcoded, it works fine.  What am I 
doing wrong? 

Thanks for any help.

Geoff 


---------------------------------------------------------------------
To unsubscribe, e-mail: tomcat-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: tomcat-user-help@jakarta.apache.org


Mime
View raw message