id is the name you want to give each item in the map as it iterates.
For more see, <
http://jakarta.apache.org/struts/struts-logic.html#iterate >
We are about to add more indexing support, which may help you further.
See the Indexed Tablibs item at
< http://husted.com/about/struts/resources.htm#taglibs >
for an early release.
Melissa wrote:
>
> I have just tried this, but the "id" attribute is apparently required. My
> guess is that this can just be an arbitrary variable... However, the bigger
> issue seems to be that the iterate tag isn't really suited to the retrieval
> of more than one oject (i.e. the hashmap's key/value pairs)...
>
> here's the old code I was hoping to "convert":
> <!--% HashMap jmap = (HashMap)request.getAttribute("hmap");
> for (Iterator i = jmap.keySet().iterator(); i.hasNext(); ) {
> String key = (String)i.next();
> Object obj = jmap.get(key);
> %>
> <tr>
> <td><font size=1><%= key %></font></td>
> <td><font size=1><%=
>obj.toString()%></font></td>
> </tr-->
> <%
> }
> %>
>
> Is there a way to integrate this into a Struts iterate tag, or should i just
> stick with the original code?
>
> Thanks so much for your help.
> Melissa
> (Strutting better every day)
>
> -----Original Message-----
> From: Ted Husted [mailto:[EMAIL PROTECTED]]
> Sent: Tuesday, July 24, 2001 11:03 AM
> To: [EMAIL PROTECTED]
> Subject: Re: Another question about the logic:iterate tag
>
> The docs say "JSP bean", but the meaning there is broad. So, yes, you
> can do this:
>
> request.setAttribute("hashmap",hashmap);
>
> ...
>
> <logic:iterate name="hashmap">
>
> To use an actual bean, you would also specify the property
>
> <logic:iterate name="javaBean" property="hashmap">
>
> which resolves to javaBean.getHashmap()
>
> Melissa wrote:
> >
> > Hi again. I am wondering whether the logic:iterate tag requires you to
> use
> > a bean (or bean property) as the collection to iterate over. I would
> > actually like to iterate over a hashmap that i placed in the request in my
> > action class, but I have not determined through the user docs whether this
> > is possible or not.
> >
> > Any help would be greatly appreciated!
> >
> > Melissa
>
> -- Ted Husted, Husted dot Com, Fairport NY USA.
> -- Custom Software ~ Technical Services.
> -- Tel 716 737-3463.
> -- http://www.husted.com/about/struts/
-- Ted Husted, Husted dot Com, Fairport NY USA.
-- Custom Software ~ Technical Services.
-- Tel 716 737-3463.
-- http://www.husted.com/about/struts/