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: Getting lines of text individually
Date Wed, 06 Mar 2002 03:47:36 GMT
On 3/5/02 7:24 PM, "Diane Holt" <holtdl@yahoo.com> wrote:

> Is there any way to say:
> Here are several
> lines of text
> treat them as
> individual items
> in a #foreach.

Sure

#set($lines= ["Hello","there","Diane"])

#foreach($line in $lines)
$line
#end

Will output

Hello
there
Diane

Now, it's no fun to specify lines of text like this in the Object array
(that's what we call the square bracket thingy...), but you could just as
well put that in anything iterable (List, for example) in your Java code,
and iterate over that as shown..

Geir


-- 
Geir Magnusson Jr.                                     geirm@optonline.net
System and Software Consulting
"He who throws mud only loses ground." - Fat Albert


--
To unsubscribe, e-mail:   <mailto:velocity-user-unsubscribe@jakarta.apache.org>
For additional commands, e-mail: <mailto:velocity-user-help@jakarta.apache.org>


Mime
View raw message