Velocity isn't perl. it doesn't directly support recursive rendering, nor will it.
you have two choices: either look into the RenderTool/ViewRenderTool in the VelocityTools project. or if your rendering is truly as simple as your example, you can just add the context to itself: context.put("A", "B"); context.put("B", "C"); context.put("ctx", context); then query it directly: $ctx.get($A) On 2/7/06, Fred Stluka <[EMAIL PROTECTED]> wrote: > 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] > > --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]