jarmod
jarmod

Reputation: 78803

Jive plugin implementation of Freemarker #list

Newbie question here about the connection between FreeMarker templates and Jive plugins (written in Java).

I have inherited an existing, working project with some FTL, as follows:

<#list employeeInstances! as instance>
  <tr>
  ...
  </tr>
</#list>

I'm trying to understand how employeeInstances is actually implemented in the Java plugin. There is no reference to 'employeeInstances' anywhere else within the project. The closest is this:

public ArrayList<EmployeeInstance> getEmployeeInstances()
{
  ...
}

I am guessing that this is what's being called when Jive sees #list employeeInstances. Is that right? Is it basically capitalizing the first letter of the sequence name 'employeeInstances' and then prefixing it with the word 'get'? I couldn't find anything in the FreeMarker or Jive documentation that discussed this.

Thanks.

Upvotes: 1

Views: 258

Answers (1)

ddekany
ddekany

Reputation: 31152

Check what data-model is passed to Template.process or Environment.process. If it's an instance of the class with the getEmployeeInstances method, then your guess was right. FreeMarker exposes JavaBean properties as variables, so getFoo() becomes to foo.

Upvotes: 1

Related Questions