API / Apache FreeMarker Interview questions
What is the purpose of interpolation (${...}) in FreeMarker?
An interpolation inserts the text value of an expression into the surrounding literal output. Written as ${expression}, it works inside plain text sections of a template - the expression is evaluated against the data model, converted to a string, and spliced into the output at that exact position.
Older FreeMarker versions also had a numerical interpolation form, #{expression}, used to apply a number format inline; it is now considered legacy and largely replaced by combining ${...} with the ?string built-in, for example ${price?string["0.00"]}, which is clearer and consistent with how every other formatting need is expressed.
More Related questions...