File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes Struts and the fly likes Struts Iterate tag and TreeMaps Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of Java Interview Guide this week in the Jobs Discussion forum!
JavaRanch » Java Forums » Frameworks » Struts
Bookmark "Struts Iterate tag and TreeMaps" Watch "Struts Iterate tag and TreeMaps" New topic

Struts Iterate tag and TreeMaps

Elizabeth Reynolds

Joined: Mar 31, 2002
Posts: 24
The following code in a JSP page is returning a Java compiler warning (i.e., local variable myiterator1 is not used), although the code works fine.
Is there a better way to do this?

<logic:iterate id="myIterator1" collection="<%= tempMap1 %>">
<LI><FONT size="2"><bean:write name="myIterator1" property="key" />
<bean:write name="myIterator1" property="value" /></FONT></LI>
tempMap1 is the result map from performing set operations and is obtained on the JSP page.
I believe the error refers to the "myIterator1" in the id field of the logic:iterate tag rather than the name field of the bean:write tag because I'm only getting one warning.
[ July 20, 2002: Message edited by: Elizabeth Reynolds ]
Tim Holloway
Saloon Keeper

Joined: Jun 25, 2001
Posts: 17423

It looks referenced to me. I'd take a peek at the Java code produced by the JSP compiler (you may have to use a "keep generated" option on your appserver).

An IDE is no substitute for an Intelligent Developer.
I agree. Here's the link:
subject: Struts Iterate tag and TreeMaps
It's not a secret anymore!