Hi Barbara,
I believe that either your class will need to implement the Collection interface, or you'd need to call the iterator() method explicitly i.e.
#foreach( $element in $myObj.iterator() )
Of course Velocity will complain/warn you about the fact that the iterator is not reusable. However it sounds like you've all but implemented the Collection anyway - providing you're able to extend java.util.AbstractCollection (leaving only size() and iterator() to implement).
- simon
Barbara Baughman wrote:
It looks like, for the first time, I am passing an object to a foreach loop that that is not a Vector, HashMap, or Array.
I instead have a class that essentially wraps a Vector of a certain type. It includes a method:
public Iterator iterator() { return v.iterator(); // return iterator of the underlying Vector }
I thought all classes with iterators would work with a #foreach loop (even though I don't see that in the documentation. However, I get the error message:
Mon Oct 18 11:22:49 CDT 2004 [warn] Could not determine type of iterator in #foreach loop at [0,0] in template member/info/facstaff.vm
The template output only provides one blank line, even though the size() method indicates there are 84 members.
Any hints or tips?
Barbara Baughman X2157
--------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
--------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]