Escape characters and #if conditionals

Backslash Escape + #if Conditional Syntax 1. Backslash \ Escape Rules Pre‑defined variable:#set($dog = “woof woof”) VTL Code Rendered Output Explanation $dog woof woof Normal variable resolution \$dog $dog Single …

Extension methods

1. Backend Person Entity Code (C#) Set object variables in C# backend code 2. VTL Template Code & Rendering Notes 1. $pTest.getMyName() ✅ Velocity parameter‑less method call: parentheses () can …

Iterate collections

Velocity #foreach Iterate over Collections & Objects 1. Iterate over String List C# Back‑end Code Velocity Template Code Execution result: Loop through each string in the list and output with …

Comments

1. Distinction of Template Comments Syntax Type Features <!– HTML comment –> Native HTML comment Output to final webpage source code, visible when viewing page source in browser ## Single‑line …

Template reuse

1. Core Purpose The Velocity template engine achieves template reuse via #include / #parse.Common webpage sections such as page header navigation _head.htm and footer copyright _footer.htm can be extracted into …

Fundamental template syntax

1. Pass Entity Objects to Templates 1.1 PageInfo Entity Class Previously we passed simple strings, which is inefficient and hard‑to‑maintain. Wrapping data into entity objects makes code much clearer. 1.2 …

Introduction to NVelocity

A template engine for the .NET platform, ported from Velocity on the Java platform. Introduction Widely adopted within ASP.NET projects;ASP.NET MVC ships with the Razor template engine; Many developers turn …