velocity-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Joe Desbonnet" <jdesbon...@gmail.com>
Subject Re: Chhecking Vector content from template
Date Wed, 28 Jun 2006 13:31:14 GMT
I'm not clear about what you want to do. Are you trying to detect an
empty Vector?

You can call the size() method on the java.util.Vector object to get
the number of elements. So ($myVec.size() == 0)  will be true for
Vectors with no elements.

Joe


On 6/28/06, Carlo Torniai <carlo.torniai@hp.com> wrote:
> Hi all.
> I'm trying to evaluate if a vector contains elements from my template.
>
> The vector is added at the context in this way from my Servlet.
>
>  ctx.put("frontrightpic", front_right_pict);
>
> I'm able to retrieve content in the template using
>
> #foreach ($photo_front_right in $frontrightpic)
>
> I want to check if the vector contains any result in order to change the
> displayed HTML.
> I've tried to use
> #if($photo_front_right=='')
>
> and also other conditions on $frontrightpic don't seem to work.
>
> Can you help me to check if vector contains any entry?
> Thanks.
> Carlo
>
>
>
> ---------------------------------------------------------------------
> 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
View raw message