You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by Shamdasani Nimmi-ANS004 <AN...@motorola.com> on 2001/02/27 21:33:35 UTC

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


Re: Modeling Struts apps with TogetherJ?

Posted by Rob Leland <Ro...@freetocreate.org>.
In January ,someone posted a sequence diagram of the struts login
process,
very informative !

Check www.mail-archive.com for it.

Maybe that could make it into our docs somehow. 

Bryan Field-Elliot wrote:
> 
> I'm exercising my new copy of TogetherJ, and at the same time learning
> Struts for the first time. I was wondering if anyone has had any
> experience trying to model a Struts application using Together? (e.g.
> which diagram types did you use, etc.)?
> 
> Regards,
> Bryan

Modeling Struts apps with TogetherJ?

Posted by Bryan Field-Elliot <br...@netmeme.org>.
I'm exercising my new copy of TogetherJ, and at the same time learning 
Struts for the first time. I was wondering if anyone has had any 
experience trying to model a Struts application using Together? (e.g. 
which diagram types did you use, etc.)?

Regards,
Bryan


Re: How do I iterate thru a hashtable using iterate tag?

Posted by Maya Muchnik <mm...@pumatech.com>.
Nimmi,

Check the properties names. In the working variant they are:
code, name, countryName. In the 2nd (not working variant) they are:
seq_nbr, name, country_name.
The second, maybe underscore sign is not allowed.
Maya

Shamdasani Nimmi-ANS004 wrote:

> 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