Velocity users,

How can I do double evaluation in Velocity?  If the value of an item on
the context is the name of an other item on the context, how can I get
the value of the second item?

For example, if the Java code does:

           Velocity.init();
           VelocityContext context = new VelocityContext();
           context.put("A", "B");
           context.put("B", "C");
template.merge(context, ...);
How can the Velocity template get the value "C" without explicitly
mentioning "B"?  I have tried:

Value of value of A is:  ${${A}}
Value of value of A is:  ${ ${A} }
Value of value of A is:  $!{$!{A}}

#set($localAAA = ${A})
Value of value of localA is ${${localAAA}}
Value of value of localA is $!{$!{localAAA}}
Value of value of localA is ${ ${localAAA} }
Value of value of localA is $!{ $!{localAAA} }

No luck...  I can get it to generate "B" from "A", but I can't get
it to then lookup "B" to get "C"

Any ideas?  Thanks!
--Fred
--------------------------------------------------------------------------
Fred Stluka -- mailto:[EMAIL PROTECTED] -- http://bristle.com/~fred/
Bristle Software, Inc -- http://bristle.com -- "Glad to be of service!"
--------------------------------------------------------------------------


---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to