velocity 教程及例子
一、Velocity脚本语法摘要
1. 变量
(1)变量的定义:
#set($name = “hello”) 说明:velocity中变量是弱类型的。
当使用#set 指令时,括在双引号中的字面字符串将解析和重新解释,如下所示:
#set($directoryRoot =”www” )
#set($templateName =”index.vm” )
#set($template =”$directoryRoot/$templateName” )
$template
输出将会是:www/index.vm[......]