aspose file tools*
The moose likes Struts and the fly likes struts 2 iterator tag Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Frameworks » Struts
Bookmark "struts 2 iterator tag " Watch "struts 2 iterator tag " New topic
Author

struts 2 iterator tag

Vijay Ramakrishnan
Greenhorn

Joined: Oct 22, 2011
Posts: 1
s:iterator value="countries">
<s:iterator value="cities">
<s:property value="name"/>, <s:property value="[1].name"/><br>
</s:iterator>

This will display

Wellington, New Zealand
Auckland, New Zealand
Moscow, Russia
Glasgow, Scotland
Edinburgh, Scotland
Stockholm, Sweden


I want to display

New Zealand
-----------
Wellington
Auckland

Russia
------

Moscow

Scotland
--------

Glasgow
Edinburgh ..

Is it possible with the iterator tag?
etc ..
Tomasz Sobal
Greenhorn

Joined: Oct 25, 2011
Posts: 3
Yes, it's possible, just get value from first iterator before the inner one starts:


Next thing to do is to pack it in some table/div container so it displays nicely
Mohana Rao Sv
Ranch Hand

Joined: Aug 01, 2007
Posts: 485

Or else you can send a map object having countries name as key and cities as list.


ocjp 6 — Feeding a person with food is a great thing in this world. Feeding the same person by transferring the knowledge is far more better thing. The reason is the amount of satisfaction which we get through food is of only one minute or two. But the satisfaction which we can get through the knowledge is of life long.
 
It is sorta covered in the JavaRanch Style Guide.
 
subject: struts 2 iterator tag