I have created two velocity token and calling one velocity token into another but after debug it print plain format i.e. {{my.VTL-1}} only.
My Velocity token script -2 is below given, {{my.VTL-1}}, {{my.VTL-2}}
#if( $test_cList.isEmpty() )
#set( $DEFAULT = 0 )
#else
{{my.VTL-1}}
#end
Below is dummy VTL-1 script
#set( $DEFAULT_VTL = 1 )
$DEFAULT_VTL
What is the correct format to call one VTL token into another one?
Solved! Go to Solution.
You can't literally put Velocity tokens inside Velocity tokens.
You set a Velocity variable ($reference) in one token, then access that variable inside a subsequent token.
All Velocity code shares a single scope, executed from top to bottom. So if {{my.token1}} is included before {{my.token2}} then {{my.token2}} can access all variables from {{my.token1}}.
You can't literally put Velocity tokens inside Velocity tokens.
You set a Velocity variable ($reference) in one token, then access that variable inside a subsequent token.
All Velocity code shares a single scope, executed from top to bottom. So if {{my.token1}} is included before {{my.token2}} then {{my.token2}} can access all variables from {{my.token1}}.