struts-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Melissa" <>
Subject RE: Another question about the logic:iterate tag
Date Tue, 24 Jul 2001 15:35:39 GMT
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);
			Object obj = jmap.get(key);
					<td><font size=1><%= key %></font></td>
					<td><font size=1><%= obj.toString()%></font></td>

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.
(Strutting better every day)

-----Original Message-----
From: Ted Husted []
Sent: Tuesday, July 24, 2001 11:03 AM
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:



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

View raw message