API / Apache Velocity Interview questions
What are Velocity Tools (VelocityTools) and why would you use them?
VelocityTools is a companion Apache project, a library of ready-made helper objects (called "tools") that you register into the context so templates get common conveniences without writing custom Java for each one.
| Tool | Purpose |
| EscapeTool ($esc) | HTML/XML/JS/URL-safe escaping of output |
| DateTool ($date) | Formatting and comparing dates |
| MathTool ($math) | Numeric operations beyond basic +/-/*// |
| ResourceTool ($text) | Locale-aware text lookup from resource bundles |
| ListTool / SortTool | Sorting and manipulating lists inside a template |
Without these, a project would end up writing and maintaining near-identical wrapper classes for formatting and escaping in every application that uses Velocity; VelocityTools exists precisely to avoid that duplication, and its tools are configured declaratively in a tools.xml file rather than wired up in Java code by hand.
More Related questions...