velocity-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Alexander Mueller <al...@gmx.at>
Subject foreach
Date Wed, 06 Mar 2002 22:50:13 GMT

Hi,

I am quite probably doing something wrong, however I am really lost :).

I have written a Context descendant, 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>


Thank you,
Alexander



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