I have legacy system which define variable as “{$variable_name}” instead of Apache Velocity Standard “${variable_name}”.
So,
“This is {$variable_name} output test.” and I call evalute it throws exception:
`org.apache.velocity.exception.ParseErrorException: Encountered "$variable_name" at <unknown template>[line 1, column 18]
Was expecting one of:
"}" ...
<WHITESPACE> ...
<NEWLINE> ...
"}" ...
<WHITESPACE> ...
<NEWLINE> ...
<WHITESPACE> ...
<NEWLINE> ...`
How to configure velocity tempalte egnine such that {$variable_name} is accepted as variable and substitide value from the VelocityContext object.
String line="This is {$variable_name} output test.";
VelocityEngine velocityEngine = new VelocityEngine(props);
velocityEngine.init();
VelocityContext context = new VelocityContext();
context.put("variable_name","my_variable");
velocityEngine.evaluate(context,sw,"",line );
Any help of pointter would be greatly appriciated
I tried to research how to customize variable but not sucessful.