velocity-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Bill Rishel" <illu...@gmail.com>
Subject Re: Array
Date Thu, 02 Mar 2006 05:42:31 GMT
yes...

Having the latest tools jar, just put:

 <tool>
   <key>list</key>
   <scope>application</scope>
   <class>org.apache.velocity.tools.generic.ListTool</class>
 </tool>

into your toobox.xml

If the array you have put into your context is say $myArray,
the you can do: $list($myArray, $indexNum)

On the other hand, if you make your array into a Vector
and put that into the context, the you can do:
$myvector.elementAt($indexNum)

Bill


On 3/1/06, Nathan Bubna <nbubna@gmail.com> wrote:
>
> get the latest velocity tools jar and put an instance of ListTool in
> the context:
>
>
> http://jakarta.apache.org/velocity/tools/javadoc/org/apache/velocity/tools/generic/ListTool.html
>
> On 3/1/06, dilan@waterfind.com.au <dilan@waterfind.com.au> wrote:
> > Hello,
> > what would be the best way to read the item of an array one by one;
> > not like;
> > #foreach( $item in $result )
> >         $item
> > #end
> >
> > i want to read it like, array[2], reading the item two of an array?
> through the velocity,
> > i have try the $array.get($result,2), and it not working, its there is a
> another way?
> >
> > --
> > This message was sent on behalf of dilan@waterfind.com.au at
> openSubscriber.com
> >
> http://www.opensubscriber.com/messages/velocity-user@jakarta.apache.org/topic.html
> >
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: velocity-user-unsubscribe@jakarta.apache.org
> > For additional commands, e-mail: velocity-user-help@jakarta.apache.org
> >
> >
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: velocity-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: velocity-user-help@jakarta.apache.org
>
>

Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message