velocity-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From jonah benton <jo...@jonah.com>
Subject Re: Macro-substitution in left-side of #set directive
Date Tue, 16 Jul 2002 00:03:25 GMT

If you add the context to the context you can put values into the context, 
with dynamically determined names, directly with a normal method call.

e.g., in java, add the context to the context:

context.put( "Context", context );

Then in velocity, call the same context.put() method to add new variables:
#set( $foo = "myvar" )
$Context.put( $foo, "value" )

After that $Context.put() call, the context variable:

$myvar

will contain:

value


At 05:22 PM 7/15/2002 -0300, you wrote:
>Is there a way to do something like this:
>
><code>
>     #set( $foo = "myvar" )
>     #set( "$foo" = "a value" )
></code>
>
>And then be able to output $myvar?
>
>
>
>--
>To unsubscribe, 
>e-mail:   <mailto:velocity-user-unsubscribe@jakarta.apache.org>
>For additional commands, e-mail: 
><mailto:velocity-user-help@jakarta.apache.org>


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