You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@velocity.apache.org by abhishek verma <as...@gmail.com> on 2006/11/29 09:27:25 UTC

problem with retrieving values from HashMap in the VTL.

Hi,
I am a new user for Velocity.
i have passed one HashMap instance in the VelocityContext.
like :-
VelocityContext context = new VelocityContext();
context.put("Service", map);
where map is the instance of a HashMap which contain key as a String  and
Value as a ArrayList.
Now in the Templete file i have to retrieve all the values from this HashMap
instance.

Kindly help me in writing the VTL code..

==Abhishek==
Hewlett-Packard

Re: problem with retrieving values from HashMap in the VTL.

Posted by Will Glass-Husain <wg...@forio.com>.
Hi.  If you use the #foreach, it will iterate through all the values

#foreach($item in $Service)
  do something with $item
#end

WILL

On 11/29/06, abhishek verma <as...@gmail.com> wrote:
> Hi,
> I am a new user for Velocity.
> i have passed one HashMap instance in the VelocityContext.
> like :-
> VelocityContext context = new VelocityContext();
> context.put("Service", map);
> where map is the instance of a HashMap which contain key as a String  and
> Value as a ArrayList.
> Now in the Templete file i have to retrieve all the values from this HashMap
> instance.
>
> Kindly help me in writing the VTL code..
>
> ==Abhishek==
> Hewlett-Packard
>
>


-- 
Forio Business Simulations

Will Glass-Husain
wglass@forio.com
www.forio.com

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