velocity-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Chris.Mo...@MSCsoftware.com
Subject A Dynamic ArrayList Literal?
Date Wed, 14 Jul 2004 21:12:52 GMT
I would like to store an ArrayList literal in a Velocity variable and then
use the stored ArrayList literal to establish a new ArrayList (and its 
contents),
e.g. I'd like to do something like:

#set($names = '["Bill","Harry","Chris","Sue"]')

#set($namesArrayList = $names)
#foreach($name in $namesArrayList)
   $name
#end

However, the above VTL results in $namesArrayList
being a variable (not an ArrayList) and hence the
foreach directive effectively does nothing.

Is there a way to do what I am attempting here?
In the second #set directive, I want $names to be
evaluated (substitution occurs) before the assignment
takes place.

Thanks!!

Chris


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