You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tapestry.apache.org by Patrick Casey <pa...@adelphia.net> on 2005/04/16 21:04:21 UTC

OGNL syntax question

This may be an easy question and if so I apologize, but after slogging
through the ognl doc, I'm still no closer to an answer to what I'm looking
for here.

I've got an Object named "theRow".
I've got a list of Field Descriptors called "theList".

For Each entry in "theList" I want to pluck the appropriate field out of the
object.

Example:

Let theRow be an Object named "soldier" with properties name, rank,
serial_number.
Let theList = {"name", "rank"}

How in ognl syntax do I construct a reference to theRow.[whatgoes here?]?

So far I'm looking at something like:

<td jwcid="@Foreach" element="td" 
        source = "ognl:theList" 
        value="ognl:theItem">
         bar
         
        <span jwcid="@Insert" value="ognl:theRow.(theItem.fieldName)" />

    </td>  

But that empathetically doesn't work. Is there some ognl equivalent to the
javascript "eval" function or something I could call here?

Ideally I'm looking to output:

<td> ognl:theRow.name </td>
<td> ognl:theRow.rank </td>


And have that then get resolved to:

<td> Patton </td>
<td> General </td>

Any help would be appreciated,

--- Pat 



---------------------------------------------------------------------
To unsubscribe, e-mail: tapestry-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: tapestry-user-help@jakarta.apache.org


Re: OGNL syntax question

Posted by Jamie Orchard-Hays <ja...@dang.com>.
You seem to have the values in your list confused with their references:

"name" and "rank" are values in theList.

To reference them you'd use theList[0] and theList[1]

But it seems like you're trying to make a Hash?
#{ "name" : "John Smith", "rank" : "Major" }

Then you could reference them:
theList.name
theList.rank

or

theList["name"]
theList["rank"]

either works in ognl

Jamie

On Apr 16, 2005, at 3:04 PM, Patrick Casey wrote:

>
> This may be an easy question and if so I apologize, but after slogging
> through the ognl doc, I'm still no closer to an answer to what I'm 
> looking
> for here.
>
> I've got an Object named "theRow".
> I've got a list of Field Descriptors called "theList".
>
> For Each entry in "theList" I want to pluck the appropriate field out 
> of the
> object.
>
> Example:
>
> Let theRow be an Object named "soldier" with properties name, rank,
> serial_number.
> Let theList = {"name", "rank"}
>
> How in ognl syntax do I construct a reference to theRow.[whatgoes 
> here?]?
>
> So far I'm looking at something like:
>
> <td jwcid="@Foreach" element="td"
>         source = "ognl:theList"
>         value="ognl:theItem">
>          bar
>
>         <span jwcid="@Insert" value="ognl:theRow.(theItem.fieldName)" 
> />
>
>     </td>
>
> But that empathetically doesn't work. Is there some ognl equivalent to 
> the
> javascript "eval" function or something I could call here?
>
> Ideally I'm looking to output:
>
> <td> ognl:theRow.name </td>
> <td> ognl:theRow.rank </td>
>
>
> And have that then get resolved to:
>
> <td> Patton </td>
> <td> General </td>
>
> Any help would be appreciated,
>
> --- Pat
>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: tapestry-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: tapestry-user-help@jakarta.apache.org
>


---------------------------------------------------------------------
To unsubscribe, e-mail: tapestry-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: tapestry-user-help@jakarta.apache.org