Win a copy of Mesos in Action this week in the Cloud/Virtualizaton forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

looping with iterate tag in struts

 
Ramesh Rajah
Greenhorn
Posts: 4
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 12617
IntelliJ IDE Ruby
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 4
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Yes.
 
Ramesh Rajah
Greenhorn
Posts: 4
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 12617
IntelliJ IDE Ruby
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Were the three links with full examples not helpful?
 
Kalai Selvi
Ranch Hand
Posts: 45
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic