struts-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Bhattad, Nilesh " <NBhat...@OneBeacon.com>
Subject How do I iterate thro multidimensional collection ?
Date Wed, 19 Jun 2002 22:36:53 GMT
Hello

I have an Object called as DataStore which is nothing but a LinkedList of
HashMap
So it carries a complete multidimensional table. In short, it is somewhat
similar to java.sql.RowSet
Now I want to iterate through DataStore using <logic:iterate> tag in order
to paint my HTML Table data.

How do I write code something like this :

<table>
	<logic:iterate id="row" name="ds">
		<tr>
			<td><bean:write name="fname"></td>
			<td><bean:write name="lname"></td>
			<td><bean:write name="age"></td>
			<td><bean:write name="profession"></td>
		</tr>
	</logic:iterate>
</table>

Assume that I have a DataStore instance "ds" in PageContext. 

http://jakarta.apache.org/struts/proposals/todo-1.1.html says that
<logic:iterate> needs to be enhanced or a new tag needs to be provided to
iterate over multiple collections in parallel. But I'm not sure whether the
problem is resolved in Struts 1.1b version or not. It seems like the
IterateTag object works only on Collection, Array, Map or Enumeration.

I have two options in order to solve the above problem.
1. Write a new tag extending from IterateTag which will loop through
DataStore. 
2. Create multiple collection objects for multiple columns... (a very dumb
idea :-) )

Please let me know if someone had come across the similar situation and have
any solution on it.

Thanks
Nilesh

--
To unsubscribe, e-mail:   <mailto:struts-user-unsubscribe@jakarta.apache.org>
For additional commands, e-mail: <mailto:struts-user-help@jakarta.apache.org>


Mime
View raw message