This week's book giveaway is in the Java 8 forum.
We're giving away four copies of Java 8 in Action and have Raoul-Gabriel Urma, Mario Fusco, and Alan Mycroft on-line!
See this thread for details.
The moose likes Struts and the fly likes iterate tag  compare Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Java 8 in Action this week in the Java 8 forum!
JavaRanch » Java Forums » Frameworks » Struts
Bookmark "iterate tag  compare" Watch "iterate tag  compare" New topic
Author

iterate tag compare

Janhvi Malhotra
Greenhorn

Joined: Jan 12, 2006
Posts: 6
Hi,
While iterating thru a logic tag, I need to compare the current object's property with the next object's property and then display.
Is it possible?
Thanks
Merrill Higginson
Ranch Hand

Joined: Feb 15, 2005
Posts: 4864
This is more complicated than it might seem. You have to allow for the case where you're at the end of the list and there is no next object. I can't think of a way to make this work with <logic:xxx> tags. Even if you figured out a way, you'd end up having to use some scriptlets anyway.

If I were you, I'd just write a scriptlet to handle this. Another possibility would be to write your own custom tag.


Merrill
Consultant, Sima Solutions
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: iterate tag compare
 
Similar Threads
in the bean:write tag, can "name" even refer to an attribute name, instead of a bean name ?
Comparing values in logic:iterator
bean:write
s:if and enum enum test.
TreeMap Sorting