.toString()
将Integer对象转变为String输出。如:$customer.age.toString()指针
以下均为有效的例子- $customer.msg[0]
- $customer.msg[$i]
- $customer.msg["velocity"]
- $customer.msg[0].value
- $customer.getMsg()[0]
- $customer.msg[0][0]
必须使用{}的情况
当输出变量与英文字母直接相连时,如:$aapple,则需要使用{}来正式定义变量:${a}apple
当你为对变量赋值或值为空时,Velocity会直接以"$变量名"的形式输出。为了防止这种情况的发生,可通过添加静默符号"!",如:$!name
推荐使用$!{name}来输出变量。
强制直接输出变量名则在前加“\”,即“\!name”。
没有评论:
发表评论