You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by Michael Frenzel <mi...@datainput.de> on 2001/09/13 15:08:52 UTC

RE: Hashtable and iterate tag

Hi Ella,
you must always specify the type: java.util.Map.Entry , when iterasting over
a hashtable, because this Instance has getter methods "getKey" and
"getValue" which are then specified by the property attribute in the
bean:write tag.

try the following:


	<logic:iterate id="val" name="res" type="java.util.Map.Entry"
scope=session>
	     <bean:write name="val" property="key" />,
		<bean:write name="val" property="value" />
	</logic:iterate>
</logic:iterate>

Ciao
Michael

-----Original Message-----
From: Eleonora Bider [mailto:ebider@verticalnet.com]
Sent: Thursday, September 13, 2001 3:16 PM
To: struts-user@jakarta.apache.org
Subject: Hashtable and iterate tag


Hi,
I used logic:iterate tag on Hashtable and the next is happened:
the iterator returns Hashtable$Entry object instead of the object of the
original type, and the results is explicit - exception on bean actions. I
think, that appropriate lines in the IterateTag.doStartTag() code should be
changed to use Map.values().iterator() instead of Map.entrySet.iterator(),
that solves the problem.

	Ella.

RE: Hashtable and iterate tag

Posted by Eleonora Bider <eb...@verticalnet.com>.
Thanks.

-----Original Message-----
From: Michael Frenzel [mailto:michael.frenzel@datainput.de]
Sent: Thu, September 13, 2001 3:09 PM
To: 'struts-user@jakarta.apache.org'
Subject: RE: Hashtable and iterate tag


Hi Ella,
you must always specify the type: java.util.Map.Entry , when iterasting over
a hashtable, because this Instance has getter methods "getKey" and
"getValue" which are then specified by the property attribute in the
bean:write tag.

try the following:


	<logic:iterate id="val" name="res" type="java.util.Map.Entry"
scope=session>
	     <bean:write name="val" property="key" />,
		<bean:write name="val" property="value" />
	</logic:iterate>
</logic:iterate>

Ciao
Michael

-----Original Message-----
From: Eleonora Bider [mailto:ebider@verticalnet.com]
Sent: Thursday, September 13, 2001 3:16 PM
To: struts-user@jakarta.apache.org
Subject: Hashtable and iterate tag


Hi,
I used logic:iterate tag on Hashtable and the next is happened:
the iterator returns Hashtable$Entry object instead of the object of the
original type, and the results is explicit - exception on bean actions. I
think, that appropriate lines in the IterateTag.doStartTag() code should be
changed to use Map.values().iterator() instead of Map.entrySet.iterator(),
that solves the problem.

	Ella.