Hi, I am trying this way:
<s:iterator id="fruitsId" status="fruitsStat" value="fruitscolourandInfo" > fruits KEY <s:property value="#fruitsId.key" /> <colour/> fruits Val <s:text name="%{fruitsStat.value}" /> <colour/> <s:iterator id="colourId" status="colourStatus" value="fruitsId.value" > colour <s:text name="%{top.value}" /> <colour/> </s:iterator> </s:iterator> The issue is that: Fruits key: is being displayed fine Fruits Val: nothing is being dislayed; infact when I tried similarly with fruits KEY even that is not being displayed. Any ideas how to get this working.. (in fact I need to get the results in textboxes next) Any help? Ravi -----Original Message----- From: Musachy Barroso [mailto:[EMAIL PROTECTED] Sent: Monday, February 18, 2008 10:09 PM To: Struts Users Mailing List Subject: Re: S2 NESTED iterators & FLAT HashMaps: When you use the "iterator" tag, the value of the "id" tag becomes the reference to the current object on that iteration(same as "top" on this case). When iterating over a map, the object is a Map.Entry, so you need to access the "key" and "value" properties, like <s:iterator id="superMap" value="myMap"> Key: <s:property value="superMap.key" /> ....same as <s:property value="key" /> Value: <s:property value="superMap.value" />....same as <s:property value="value" /> </s:iterator> is not a direct answer to your question, but I think your problem is around that. //you can always do %{superMap[top.key]} to access the value, it is just harder to read regards musachy On Feb 18, 2008 11:21 AM, ravi_eze <[EMAIL PROTECTED]> wrote: > > hi, > > i have 4 hashmaps as follows: > (1). HashMap<String, HashSet<String>> treesFruitsMap = new HashMap(); > (2). HashMap<String, HashSet<String>> fruitsColourMap = new HashMap(); > (3). HashMap<String, String> colourVitaminMap = new HashMap(); > > i.e. > (1) has the mapping btw tree names and the fruits it bears (as a set of > strings) > (2) has the mapping btw fruit name and the possible colours it can come out > in > (3) mapping btw fruit and the vitamins it has in it. > > I need to display the output as follows: > Fruit1 - Colour1 - Vitamin1 > Fruit1 - Colour1 - Vitamin2 > Fruit1 - Colour2 - < corresponding vitamins > > ... > > any idea how to go with this? I tried as follows but its not working.. > > <s:iterator id="frId" status="frStat" value="frColourMap.keySet()" > > <s:iterator id="coId" status="coStatus" value="top" > > FE <s:text name="%{top}" /> <br/> > BR <s:text name="%{coStatus[top]}" /> <br/> > </s:iterator> > </s:iterator> > > this is giving only the fruits names but not the colours... > > pl: help. > > -- > View this message in context: http://www.nabble.com/S2-NESTED-iterators---FLAT-HashMaps%3A-tp15546918p 15546918.html > Sent from the Struts - User mailing list archive at Nabble.com. > > > --------------------------------------------------------------------- > To unsubscribe, e-mail: [EMAIL PROTECTED] > For additional commands, e-mail: [EMAIL PROTECTED] > > -- "Hey you! Would you help me to carry the stone?" Pink Floyd --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]