How to iterate over two collections ?

2003-11-17 Thread Vinita Keswani
Hello, Could anyone please tell me if there is a workaround for iterating over two collections at the same time when both have the same key but different values? For eg: Descr, Cost,Volume Two maps one is - costMap which has descr and cost and another one is - volMap which has descr and

Re: How to iterate over two collections ?

2003-11-17 Thread Brice Ruth
You could loop over one collection, exposing the varStatus, which contains the key, and use the key to look up in the second map ... I think? Vinita Keswani wrote: Hello, Could anyone please tell me if there is a workaround for iterating over two collections at the same time when both have the

Re: How to iterate over two collections ?

2003-11-17 Thread Kris Schneider
With JSTL: c:forEach var=entry items=${costMap} c:out value=${entry.value}/ c:out value=${volMap[entry.key]}/ /c:forEach Quoting Brice Ruth [EMAIL PROTECTED]: You could loop over one collection, exposing the varStatus, which contains the key, and use the key to look up in the second map

Re: How to iterate over two collections ?

2003-11-17 Thread Vinita Keswani
Thanks but in any case I have to create an iterator to loop thru the maps.What I want to do is to have one loop and to pick up value entries from another - yes may be I can try using lookups using key??? Kris Schneider [EMAIL PROTECTED] wrote:With JSTL: Quoting Brice Ruth : You could

Re: How to iterate over two collections ?

2003-11-17 Thread Rick Reumann
Vinita Keswani wrote: Hello, Could anyone please tell me if there is a workaround for iterating over two collections at the same time when both have the same key but different values? For eg: Descr, Cost,Volume Two maps one is - costMap which has descr and cost and another one is - volMap

Re: How to iterate over two collections ?

2003-11-17 Thread Kris Schneider
I think the code I provided does what you were asking for, but maybe I'm missing something. Perhaps adding comments to my example will help: %-- iterate through costMap, entry will be an instance of Map.Entry --% %-- Map.Entry exposes two properties: key and value --% c:forEach

Re: How to iterate over two collections ?

2003-11-17 Thread Vinita Keswani
Thanks again... Yes I have to lookup using the key ..that will work fine..Thanks again. Kris Schneider [EMAIL PROTECTED] wrote: I think the code I provided does what you were asking for, but maybe I'm missing something. Perhaps adding comments to my example will help: Quoting