## 7.2. 屬性
VTL引用的第二種元素是屬性,而屬性具有獨特的格式。屬性的簡略標記識前導符$后跟一個VTL 標識符,在后跟一個點號(".")最后又是一個VTL 標識符。這是一些有效的示例:
```
$customer.Address
$purchase.Total
```
請看第一個例子,$customer.Address.。他有兩種意思。它可以意味著,查詢由customer標是的哈希表并按關鍵字Address返回值。但是$customer.Address也可能引用一個方法(下述,$customer.Address可能是$customer.getAddress().的縮寫。當一個頁面被請求時,Velocity 將決定這兩種可能到底是哪一個,然后返回相應的值。
- 1. 關于
- 2. 什么是Velocity?
- 3. Velocity 可以做什么?
- 3.1. Mud Store 示例
- 4. Velocity模板語言(VTL): 介紹
- 5. Hello Velocity World!
- 6. 注釋
- 7. 引用
- 7.1. 變量Variables
- 7.2. 屬性
- 7.3. 方法
- 8. 形式引用符Formal Reference Notation
- 9. 安靜引用符Quiet Reference Notation
- 11. Case Substitution
- 12. 指令
- 12.1. #set
- 12.2. 字面字符串
- 12.3. 條件
- 12.3.1 If / ElseIf / Else
- 12.3.2 關系和邏輯操作符
- 12.4. 循環
- 12.4.1. Foreach 循環
- 12.5. 包含
- 12.6. 解析
- 12.7. 停止
- 12.10. 宏
- 12.10.1. Velocimacro 參數
- 12.10.2. Velocimacro 屬性
- 12.10.3. Velocimacro Trivia
- 13. Getting literal
- 13.1. 貨幣字符
- 13.2. 轉義 有效的 VTL 指令
- 13.3. 轉義 無效的 VTL 指令
- 14. VTL 格式化問題
- 15. 其它特征和雜項
- 15.1. 數學特征
- 15.2. 范圍操作符
- 15.3. 進階:轉義和!
- 15.4. Velocimacro 雜記
- 15.5. 字符串聯