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: foreach
Date Wed, 06 Mar 2002 23:00:19 GMT
On 3/6/02 5:50 PM, "Alexander Mueller" <alexm@gmx.at> wrote:

> 
> Hi,
> 
> I am quite probably doing something wrong, however I am really lost :).
> 
> I have written a Context descendant,

?  Something derived from the Context class?

>in order to stay independent from
> the particular template (want to have the possibility to use the
> variables in each HTML template). This context checks in the get
> method the given key and returns the particular data. Now I have
> a foreach statement in the template, which makes my Context returning
> a string array. However it simply does not work. What am I doing wrong?
> 
> 
> This is the get method of my own Context.
> 
> public Object get(String key)
> {
>   if (key.equals("dummy")) return new String[]{"1","2","3"};
>   .
>   .
> }
> 
> 
> And this is the statement in the HTML template.
> 
> <select name="dummy">
> #foreach ($a in $dummy)
> <option>$a</option>
> #end
> </select>

That's surprising, actually.  We use isArray() to check in the case of an
Object...

Anything in the log?


-- 
Geir Magnusson Jr.                                      geirm@optonline.net
System and Software Consulting
"Whoever would overthrow the liberty of a nation must begin by subduing the
freeness of speech." - Benjamin Franklin



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