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

looping with iterate tag in struts

Ramesh Rajah
Greenhorn

Joined: Feb 26, 2008
Posts: 4
Hi all,

I have an arraylist of objects with properties ( day, month, year ) and I want to print an html table using struts 1.2 iterator tag. Each html row with have day, month, and year.

I want exactly similar what is done here http://www.coderanch.com/t/429477/Struts/struts-iterator-tag#1907044

but I think they use struts 2.0 , could you tell me how I would accomplish it using iterator tag in struts.

Ramesh
David Newton
Author
Rancher

Joined: Sep 29, 2008
Posts: 12617

Do you mean the logic:iterate tag in Struts 1?

There are some examples here and here, as well as the tag documentation here.
Ramesh Rajah
Greenhorn

Joined: Feb 26, 2008
Posts: 4
Yes.
Ramesh Rajah
Greenhorn

Joined: Feb 26, 2008
Posts: 4
Hi David,

I eventually want to generate a table to show my object properties on my page. I think it is better done with logic:iterate tag. I have an arraylist of objects with properties day, month, year.



Your help is appreciated.

Ramesh
David Newton
Author
Rancher

Joined: Sep 29, 2008
Posts: 12617

Were the three links with full examples not helpful?
Kalai Selvi
Ranch Hand

Joined: Jan 08, 2007
Posts: 45
Here is the sample to do what you want. Hope this helps

In this code,
returnList - the collection which has your day, month and year
myCollectionElement - just an id, you can give any name for this



This code will print the collection in table format.

Thanks
Kalai
 
It is sorta covered in the JavaRanch Style Guide.
 
subject: looping with iterate tag in struts