velocity-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Townson, Chris" <>
Subject RE: finding the length of an array
Date Thu, 18 Aug 2005 14:18:25 GMT
>after reading through Jean Francois Chamard's excellent technique for 
>finding the last item in an array with Velocity (posted 22/07/2005), 
>I've been trying to implement this for a array of HTML links.
>>however, I've been encountering problems using the length method which 
>>is used there: it's just failing silently (haven't got access to the 
>>velocity log for this at present, unfortunately).
>>Any comments/suggestions/help/answers gratefully received!

>Hi Chris,
>perhaps I am mistaken but even in Velocity 1.5 dev, you can't find the
length of an array with $array.length so your length (in velocity) is
probably null
>I use an object which I put in my velocity context to get the length of an
>I found something similar in the velocity mailling archive before I wrote
the class above.
>Then in velocity, if you give the class the name arrayUtil, you call it
that way..
>this will return the good length
>I hope it helps
>Jean-Francois Chamard

thanks - I really need to find a way to do this using only standard public
class methods (+ the usual velocity tools)

would it be possible to find the last element in an array using the size
method of the ArrayList class?


DISCLAIMER: This e-mail is confidential and should not be used by anyone who is
not the original intended recipient. If you have received this e-mail in error
please inform the sender and delete it from your mailbox or any other storage
mechanism. Neither Macmillan Publishers Limited nor any of its agents accept
liability for any statements made which are clearly the sender's own and not
expressly made on behalf of Macmillan Publishers Limited or one of its agents.
Please note that neither Macmillan Publishers Limited nor any of its agents
accept any responsibility for viruses that may be contained in this e-mail or
its attachments and it is your responsibility to scan the e-mail and 
attachments (if any). No contracts may be concluded on behalf of Macmillan 
Publishers Limited or its agents by means of e-mail communication. Macmillan 
Publishers Limited Registered in England and Wales with registered number 785998 
Registered Office Brunel Road, Houndmills, Basingstoke RG21 6XS   
View raw message