You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@velocity.apache.org by "Leyzerzon, Simeon G" <Si...@gs.com> on 2003/02/28 16:47:49 UTC

foreach over map

What is the syntax to return the key while using #foreach over Map?
Thanks.
Simeon

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


Re: foreach over map

Posted by Dave Newton <da...@solaraccess.com>.
On Fri, 2003-02-28 at 10:47, Leyzerzon, Simeon G wrote:
> What is the syntax to return the key while using #foreach over Map?

http://jakarta.apache.org/velocity/user-guide.html#Loops provides the
following information (isn't documentation wonderful? :)

<ul>
#foreach( $key in $allProducts.keySet() )
    <li>Key: $key -> Value: $allProducts.get($key)</li>
#end
</ul>

Dave



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


Re: foreach over map

Posted by Denis <br...@mac.com>.
#foreach ( $item in $map.keySet() )
  $item : $map.get($item)
#end

-- Denis.

On Friday, February 28, 2003, at 03:47  pm, Leyzerzon, Simeon G wrote:

> What is the syntax to return the key while using #foreach over Map?
> Thanks.
> Simeon
>


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