API / Apache Velocity Interview questions
Explain the purpose of the #include directive?
#include pulls another file's raw content into the current template output verbatim, without parsing it as VTL. It's meant for static content, such as a legal disclaimer, a snippet of pre-formatted HTML, or a plain text block, that doesn't need any templating logic.
#include("footer-disclaimer.txt")
Because the included file is never parsed, any $ or # characters inside it are copied through literally rather than being evaluated. If you need the included content to itself contain directives or references that should be evaluated, #parse is the correct directive instead, not #include.
More Related questions...