You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@velocity.apache.org by ki...@gmx.net on 2012/07/06 13:49:54 UTC

double evaluation

Hello Velocity Users,

in our VelocityContext, there is a list called "sourceIds", which lists the available ids. In addition, there are HashMaps in the VelocityContext registered under the available ids. Maps are as many as ids, of course.

So, for example we have: sourceIds = [src1, scr2] and therefore two maps src1 and src2 in the context.

How can we refer to the map object?

Using #foreach ( $id in $sourceIds ), first of all the String "src1" is the value of id ($id). But how can wie refer to the object stored under "src1" in the VelocityContext?

$($id).getContent() did not work (it was (src).getContent()).

Kind regards,
Kieran

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


Re: double evaluation

Posted by Nathan Bubna <nb...@gmail.com>.
Put the context in the context:

context.put("context", context);

Then do:

$context.get($id).content

On Fri, Jul 6, 2012 at 4:49 AM,  <ki...@gmx.net> wrote:
> Hello Velocity Users,
>
> in our VelocityContext, there is a list called "sourceIds", which lists the available ids. In addition, there are HashMaps in the VelocityContext registered under the available ids. Maps are as many as ids, of course.
>
> So, for example we have: sourceIds = [src1, scr2] and therefore two maps src1 and src2 in the context.
>
> How can we refer to the map object?
>
> Using #foreach ( $id in $sourceIds ), first of all the String "src1" is the value of id ($id). But how can wie refer to the object stored under "src1" in the VelocityContext?
>
> $($id).getContent() did not work (it was (src).getContent()).
>
> Kind regards,
> Kieran
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@velocity.apache.org
> For additional commands, e-mail: user-help@velocity.apache.org
>

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