aspose file tools*
The moose likes Struts and the fly likes question abut logic:iterate tag Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Soft Skills this week in the Jobs Discussion forum!
JavaRanch » Java Forums » Frameworks » Struts
Bookmark "question abut logic:iterate tag" Watch "question abut logic:iterate tag" New topic
Author

question abut logic:iterate tag

John Smith
Greenhorn

Joined: Oct 07, 2003
Posts: 15
I have a collection that might contain 5 or 7 values. it might vary, but I want them to display in 3 rows by 3 columns by using iteration tag. so the tricky thing is that I don't know how to put "<br>" after each 3rd and 6th value. I am just wondering if it is possible to use it with Struts' currently existing tags or I have to create my own tags.

Thanks..
sanat
Ranch Hand

Joined: Dec 08, 2004
Posts: 111

I think this can be achieved using <logic:iterate> and <logic:equals>.
Here basically you have to check for the index number of the element and if index%3=1 you can insert one line break.
Franck Tranchant
Ranch Hand

Joined: Aug 07, 2003
Posts: 75
Hi

As Sanat Kumar Padhy previously said, you won't have to create your own tags for this.
The only thing is, as far I as know, you propably won't be able to manage this 100% with Struts. You will need a little bit of Java in your JSP.

For example :will give you access to any data of your collection plus an indexId wich will be useful to know where you are in your iteration.

Then, while iterating on your data, a simple Java code such aswill give you the control of your table structure.

Note : Pay attention, the indexId value may be zero based

PS: If someone know how do that without any Java code, only with Struts tags, please let us know.
[ March 15, 2005: Message edited by: Franck Tranchant ]

Franck<p>--------------------
John Smith
Greenhorn

Joined: Oct 07, 2003
Posts: 15
great, thanks.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: question abut logic:iterate tag