--- Reinhard Moosauer <[EMAIL PROTECTED]> wrote: > Hi List, > > it seemed clear to me, that this construct: > > <c:forEach items="${t.records}" var="x"> > ... (some inner logic) > </c:forEach> > > should be equivalent to this one:
No. It is roughly equvalent to (see my corrections): > <% > for (Iterator it=t.getRecords(); it.hasNext(); ) { for (Iterator it=t.getRecords().getIterator(); it.hasNext(); ) { > String x = (String)it.next(); Object x = it.next(); > %> > ... (some inner logic) > <% } > %> I said roughly, because it can handle arrays, too. > But the forEach-version is not working as expected. What can be wrong? > Here are some quite strange effects: > 1. The iterators-method "hasNext()" is called twice for every iteration > (ok: no problem, if the iterator is clean, but why?) This is normal. Try to locate the java code generated from that tag and see what it comes to. You'll see something educational. There is no "while ()" loop. Just "if () else" logic. > 2. The loop-body is executed after hasNext() returned false. > But the next()-method is NOT called ?? That would be strange. Nix. __________________________________________________ Do You Yahoo!? Tired of spam? Yahoo! Mail has the best spam protection around http://mail.yahoo.com --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]