Velocity - delete fields when they cannot be combined

I use speed to merge a string (template) with a type field

hi there I'am ${name},
And I'am ${age} old.
Speed

merged the field ${name}and ${age}with a hash table view:

velocityEngine.evaluate(context, writer, "", template);

context- hash table (or better a VelocityContext)

I want Velocity not to be able to find the field in the context that it just deletes.

can i do this with a property or something else?

+3
source share
1 answer

Not sure if this is what you are asking for, but if you want unallocated template templates to be displayed in merged templates, you can use quiet notation by writing $!{name}, there is also a global setting for that.

+1
source

Source: https://habr.com/ru/post/1721703/


All Articles