velocity-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Geir Magnusson Jr. <ge...@optonline.net>
Subject Re: load array vtl
Date Tue, 14 Oct 2003 14:51:50 GMT

On Tuesday, October 14, 2003, at 07:59 AM, Sara Frongillo wrote:

> Hello,
>
> I have a problem to load a ArrayList in velocity template, in Velocity 
> Servlet I have:
>
>           ArrayList images = new ArrayList();
>           ArrayList audios = new ArrayList();
>           ArrayList videos = new ArrayList();
>
>           context.put("images", images);
>           context.put("audios", audios);
>           context.put("videos", videos);
>
> and into Template I use them as follow:
>
>    #foreach($item in $info)
>   #if($item.getDescrTipoInfoMultimediale().equals("Foto"))
>      $images.add($item)
>   #end
>    #if($item.getDescrTipoInfoMultimediale().equals("Audio"))
>    $audios.add($item)
>   #end
>    #if($info.getDescrTipoInfoMultimediale().equals("Video"))
>      $videos.add($item)
>   #end
>     #end
>
> but add() method add only 1 object and no more (if there are).
>
> Will appreciate if someone can help or suggest me a method for load a 
> array in VTL
>

This looks fine.  Why not throw some debugging in the template and do 
some output near each $<array>.add() - then you know what is getting 
selected as what...

> _________________________________
> Sara Frongillo
> Software Area
>
> I.T.Sys srl
> C.so Garibaldi, 215
> 84125 Salerno - Italy
>
> Office +390892580977
> Email s.frongillo@itsys.it
> Web http://www.nexsoft.it
>
-- 
Geir Magnusson Jr                                   203-247-1713(m)
geirm@optonline.net


---------------------------------------------------------------------
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