Paolo Beccari wrote:

Hi there,

here:
http://struts.apache.org/2.x/docs/ognl.html

I found that:
To select a subset of a collection (called projection), use a wildcard
within the collection.
? - All elements matching the selection logic
^ - Only the first element matching the selection logic
$ - Only the last element matching the selection logic
To obtain a subset of just male relatives from the object person:
person.relatives.{? #this.gender == 'male'}

I can't find the correct syntax to pass a variable (picked from valueStack)
instead of the string 'male'

Someone can help or point me the docs?
P.

If the value you want to retrieve in place of the string 'male' is a property on your action, just reference it by name. Otherwise, use the '#' notation to access it, as in

    person.relatives.{? #this.gender == someProperty}
    person.relatives.{? #this.gender == #somethingElse}

If that doesn't do the trick, you'll need to post more details of what data you have stored where and what you want to access.

L.

ObWhine: please don't post unrelated questions to an existing thread. Be sure to start a new thread (with an appropriate subject) by sending a fresh message to the list, rather than using Reply To.


---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to