Craig answered a similar question on Sunday. I think it might help you,
there he stated:
When you iterate over a Hashtable (or any other Map), the elements of
the iteration are of class "Map.Entry", which has two properties --
"key" and "value".
The other posting did not appear to need a Hashtable and he further
suggested the possible use of an ArrayList, etc. If that would work in your
situation it might simplify your problem.
Tracy
-----Original Message-----
From: Shamdasani Nimmi-ANS004 [mailto:[EMAIL PROTECTED]]
Sent: Tuesday, February 27, 2001 2:34 PM
To: '[EMAIL PROTECTED]'
Subject: How do I iterate thru a hashtable using iterate tag?
Hi,
Could someone please tell me what I am doing wrong below:
user is a bean in session scope in my JSP and its getSuppliers() method
returns a hashtable where keys are Suppliers Ids and elements are Supplier
beans.
<logic:iterate collection="<%= user.getSuppliers() %>" id="supplier"
type="com.motorola.mms.msqc.beans.SupplierBean">
<TR>
<TD><bean:write name="supplier" property="seq_nbr" scope="page" /></TD>
<TD><bean:write name="supplier" property="name" scope="page" /></TD>
<TD><bean:write name="supplier" property="country_name" scope="page" /></TD>
</TR>
</logic:iterate>
------------------------------------------------------
I had the following code earlier and that was working.
<%
Hashtable hashTable = (Hashtable) user.getSuppliers();
for (Enumeration e = hashTable.elements(); e.hasMoreElements(); ) {
SupplierBean supplier = (SupplierBean) e.nextElement();
%>
<TR>
<TD><%= supplier.getCode() %></FONT></TD>
<TD><%= supplier.getName() %></TD>
<TD><%= supplier.getCountryName() %></FONT></TD>
</TR>
<% } %>
Thanks in advance.
-Nimmi