Demetz Markus <[EMAIL PROTECTED]> wrote:
> hello,
>
> i'm very new to velocity
> i want to do a think like following:
>
> my context looks like this:
>
> context.put("name1", "something"),
> context.put("name2", "somethingelse"), ...
>
> my temlate has a loop:
> #foreach($record in $list)
> $name$velocityCount
> #end
>
> the result only is $name1 $name2 but I would like to have the context of
> $name1 $name2 -> something and something else...
> is this possible?
You can do this with the eval method of the RenderTool.
http://jakarta.apache.org/velocity/tools/javadoc/org/apache/velocity/tools/generic/RenderTool.html
However, you might be better off changing the data struture(s) that you're
putting into your context rather than building variables in the template.
For example, put the names in a map with the $record as a key, or create a
new data struture that contains both record and names and put them in a
list, or just put the names in a list.
-Mike
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]