You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tapestry.apache.org by Darío Vasconcelos <da...@gmail.com> on 2005/06/29 07:40:19 UTC

OGNL expression for navigating a HashMap

Hi All,

I'm trying to find an ognl expression that would extract a key's value
from a HashMap. The OGNL site documentation states that
     someMap["size"]
would do the trick, but it doesn't work. I've also tried several other
possibilities but with no luck.

Is there a way to do such a thing, or should I populate a custom POJO?

Regards,

Dario

PS. What I'm trying to do is something like 
	<tr jwcid="@Foreach" source="ognl:packages" value="ognl:package" element="tr">
		<td><span jwcid="package" /></td>
	</tr>

and in the .page:

	 <component id="package" type="Insert">
		 <binding name="value">
			 package["someKey"]
		 </binding>
	 </component>

maybe the problem is right here?

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


Re: OGNL expression for navigating a HashMap

Posted by Darío Vasconcelos <da...@gmail.com>.
Silly me. I found the error while grabbing the code to reply to your
response. Turns out, I was specifying the "package" property as a
java.lang.String, not as java.util.HashMap. Changing that solved the
problem.

I guess what I needed was to get some sleep and someone to confirm me
that the error was somewhere else.

Thanks a lot!
   


On 6/29/05, Norbert Sándor <de...@erinors.com> wrote:
> If getPackages() returns an iterator or iterable collection of Map instances
> then
> 
>      package["someKey"]
> 
> is correct, or you can even write
> 
>     package.someKey
> 
> Please write some details about the problem/error message you get. (+ maybe
> include the Java sources.)
> Br,
> Norbi
> 
> ----- Original Message -----
> From: "Darío Vasconcelos" <da...@gmail.com>
> To: <ta...@jakarta.apache.org>
> Sent: Wednesday, June 29, 2005 7:40 AM
> Subject: OGNL expression for navigating a HashMap
> 
> 
> Hi All,
> 
> I'm trying to find an ognl expression that would extract a key's value
> from a HashMap. The OGNL site documentation states that
>      someMap["size"]
> would do the trick, but it doesn't work. I've also tried several other
> possibilities but with no luck.
> 
> Is there a way to do such a thing, or should I populate a custom POJO?
> 
> Regards,
> 
> Dario
> 
> PS. What I'm trying to do is something like
> <tr jwcid="@Foreach" source="ognl:packages" value="ognl:package"
> element="tr">
> <td><span jwcid="package" /></td>
> </tr>
> 
> and in the .page:
> 
> <component id="package" type="Insert">
> <binding name="value">
> package["someKey"]
> </binding>
> </component>
> 
> maybe the problem is right here?
> 
> ---------------------------------------------------------------------
> 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
> 
> 


-- 
Una multa es un impuesto por hacer algo malo. Un impuesto es una multa
por hacer algo bueno.

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


Re: OGNL expression for navigating a HashMap

Posted by Norbert Sándor <de...@erinors.com>.
If getPackages() returns an iterator or iterable collection of Map instances 
then

     package["someKey"]

is correct, or you can even write

    package.someKey

Please write some details about the problem/error message you get. (+ maybe 
include the Java sources.)
Br,
Norbi

----- Original Message ----- 
From: "Darío Vasconcelos" <da...@gmail.com>
To: <ta...@jakarta.apache.org>
Sent: Wednesday, June 29, 2005 7:40 AM
Subject: OGNL expression for navigating a HashMap


Hi All,

I'm trying to find an ognl expression that would extract a key's value
from a HashMap. The OGNL site documentation states that
     someMap["size"]
would do the trick, but it doesn't work. I've also tried several other
possibilities but with no luck.

Is there a way to do such a thing, or should I populate a custom POJO?

Regards,

Dario

PS. What I'm trying to do is something like
<tr jwcid="@Foreach" source="ognl:packages" value="ognl:package" 
element="tr">
<td><span jwcid="package" /></td>
</tr>

and in the .page:

<component id="package" type="Insert">
<binding name="value">
package["someKey"]
</binding>
</component>

maybe the problem is right here?

---------------------------------------------------------------------
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