File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
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 Murach's Java Servlets and JSP this week in the Servlets forum!
JavaRanch » Java Forums » Frameworks » Struts
Bookmark "Struts Iterate tag and TreeMaps" Watch "Struts Iterate tag and TreeMaps" New topic
Author

Struts Iterate tag and TreeMaps

Elizabeth Reynolds
Greenhorn

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?

<UL>
<logic:iterate id="myIterator1" collection="<%= tempMap1 %>">
<LI><FONT size="2"><bean:write name="myIterator1" property="key" />
<bean:write name="myIterator1" property="value" /></FONT></LI>
</logic:iterate>
</UL>
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: 15951
    
  19

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).


Customer surveys are for companies who didn't pay proper attention to begin with.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Struts Iterate tag and TreeMaps
 
Similar Threads
Struts newbie question - bean:message
pass a variable in the URl
help with html radio tag
logic:match , logic:notEqual not working
Not able to validate my JSP