You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by Emil Dombagolla <do...@gmail.com> on 2010/11/02 15:04:44 UTC
get value to specific key
Dear all ,
Please please help me on this,
I have a map with iterator tag, i need to get a value for a specific key,
can i do this
<s:iterator value="MAP">
I want to say <s:property value="MAP['KEY'] "/> , i expect VALUE for
the relevant key
</s:iterator>
Thanks Lot.
emil
Re: get value to specific key
Posted by Emil Dombagolla <do...@gmail.com>.
Hi all,
Thanks a lot for the solutions.
Emil
On Wed, Nov 3, 2010 at 9:30 AM, Dale Newfield <da...@newfield.org> wrote:
> in Java you have two tools to get what you're asking for:
>
> Map has an entrySet() method returns a Set<Map.Entry>, each one of which
> has a getKey() and a getValue() method.
> The original map also has a get() method.
>
> So translating to ognl, you can iterate over map.entrySet(), and use
> top.key, top.value (or just key, value)...or wherever you have a key, you
> can always say map.get(key).
>
> -Dale
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
> For additional commands, e-mail: user-help@struts.apache.org
>
>
Re: get value to specific key
Posted by Dale Newfield <da...@newfield.org>.
in Java you have two tools to get what you're asking for:
Map has an entrySet() method returns a Set<Map.Entry>, each one of which
has a getKey() and a getValue() method.
The original map also has a get() method.
So translating to ognl, you can iterate over map.entrySet(), and use
top.key, top.value (or just key, value)...or wherever you have a key,
you can always say map.get(key).
-Dale
---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org
Re: get value to specific key
Posted by Matthias Rakowski <ma...@rakowski.biz>.
This should work:
<s:iterator value="MAP">
<s:property value="KEY"/>
</s:iterator>
> <s:iterator value="MAP">
>
> I want to say<s:property value="MAP['KEY'] "/> , i expect VALUE for
> the relevant key
>
> </s:iterator>
---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org
Re: get value to specific key
Posted by Maurizio Cucchiara <ma...@gmail.com>.
You should be able to access on a specific map item through
<s:property value="map.key"/>
or
<s:property value="map['key']"/>
You also should be able to iterate through
<s:iterator value="map">
<s:property value="key"/>
<s:property value="value"/>
</s:iterator>
2010/11/2 Emil Dombagolla <do...@gmail.com>:
> Dear all ,
>
> Please please help me on this,
>
> I have a map with iterator tag, i need to get a value for a specific key,
> can i do this
>
> <s:iterator value="MAP">
>
> I want to say <s:property value="MAP['KEY'] "/> , i expect VALUE for
> the relevant key
>
> </s:iterator>
>
> Thanks Lot.
> emil
>
--
Maurizio Cucchiara
---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org