我可以通过Velocity中的属性名访问吗?

时间:2013-04-30 12:18:44

标签: java properties velocity getter

我有一个例子

#set($organizationId = $layout.getGroup().getOrganizationId())

我可以将其重写为

#set($organizationId = $layout.group.organizationId)

它会完全一样吗?

1 个答案:

答案 0 :(得分:2)

是。请参见此处:Velocity User Guide - Property Lookup Rules,其中说明:

例如,$customer.address,序列为

  1. getaddress()
  2. getAddress()
  3. get("address")
  4. isAddress()
  5. 更准确地说,Velocity User Guide - Case Substitution

    $data.getRequest().getServerName()
    ## is the same as
    $data.Request.ServerName
    
相关问题