Instead of "[0]", use "that". Here's why:

[n] really means, "give me a sub-stack starting at point n". So [0] is
basically saying, "give me the whole valuestack".

"that" means "give me the top of the stack" (the reason it is "that"
instead of "this" is because "this" was a reserved word in Ognl).

And, just to be super duper tricky, let's play some trivia:

Q. What does "[1].that" return?
A. It returns the item that is second from the top of the stack

-Pat

-----Original Message-----
From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] On Behalf Of
Robert Douglass
Sent: Thursday, October 16, 2003 12:57 PM
To: [EMAIL PROTECTED]
Subject: RE: [OS-webwork] Understanding Iterators

I can ask the same question again with a code example that is perhaps a
little easier to understand quickly. The code that follows attempts to
append one list to another. I'd like to know exactly what kind of Object
I'm
getting here [apple1, [EMAIL PROTECTED], and how might I achieve
the
desired result?

        <ww:set name="apples" value="{'apple1', 'apple2', 'apple2'}"/>
        <ww:set name="oranges" value="{'orange1', 'orange2'}"/>
        <ww:iterator value="#apples" >
                <ww:property value="#oranges.add([0])"/><br>
        </ww:iterator>
        <hr>
        <ww:iterator value="#oranges" >
                <ww:property/><br>
        </ww:iterator>

output:

true
true
true
-----------------
orange1
orange2
[apple1, [EMAIL PROTECTED]
[apple2, [EMAIL PROTECTED]
[apple2, [EMAIL PROTECTED]



-------------------------------------------------------
This SF.net email is sponsored by: SF.net Giveback Program.
SourceForge.net hosts over 70,000 Open Source Projects.
See the people who have HELPED US provide better services:
Click here: http://sourceforge.net/supporters.php
_______________________________________________
Opensymphony-webwork mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/opensymphony-webwork


-------------------------------------------------------
This SF.net email is sponsored by: SF.net Giveback Program.
SourceForge.net hosts over 70,000 Open Source Projects.
See the people who have HELPED US provide better services:
Click here: http://sourceforge.net/supporters.php
_______________________________________________
Opensymphony-webwork mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/opensymphony-webwork

Reply via email to