You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@velocity.apache.org by Anagha <an...@gmail.com> on 2006/02/08 13:45:54 UTC

IteratorTool

Hi,
I'm trying to use ItertorTool()
When the specific condition is met (item =1), then I want to fetch from the
property object( userprops) based on the key which is next
to the curent iterator element.
i.e. $item = 1 I want to fetch properties.get(2).
Bur the following VTL is not working as desired.

#set ($numbers = $mill.wrap($titles))
#foreach ($item in $numbers)

#if($item.equals("1"))
#set ($sometext = $userprops.get($numbers.next())) ##
$sometext
#end

 $numbers.more()
 #end

Any pointers?
--
Thanks & Regards,
Anagha

Re: IteratorTool

Posted by Nathan Bubna <nb...@gmail.com>.
are you sure you want to do a .equals() comparison?  are you sure that
$userprops.get() will recognize the values in $numbers?  there are
many places your VTL could fail.  try to narrow down the problem by
simplifying it in various ways.

On 2/8/06, Anagha <an...@gmail.com> wrote:
> Hi,
> I'm trying to use ItertorTool()
> When the specific condition is met (item =1), then I want to fetch from the
> property object( userprops) based on the key which is next
> to the curent iterator element.
> i.e. $item = 1 I want to fetch properties.get(2).
> Bur the following VTL is not working as desired.
>
> #set ($numbers = $mill.wrap($titles))
> #foreach ($item in $numbers)
>
> #if($item.equals("1"))
> #set ($sometext = $userprops.get($numbers.next())) ##
> $sometext
> #end
>
>  $numbers.more()
>  #end
>
> Any pointers?
> --
> Thanks & Regards,
> Anagha
>
>

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