Alfresco- Pass variable values from js controller to freemarker

993 views Asked by At

can anybody tell me what am I doing wrong?

I want to retrieve all my alfresco sites with this code (this should work):

model.sites = siteService.listSites(null, null, 0); // return type= List<Site>

And now i want to retrieve this list model.sites in my HTML freemarker template like this:

 <body> ${sites} </body>

How can I view this sites list. I know i am getting it wrong in my ftl, but can't find a solution how to retrieve it.

1

There are 1 answers

1
Gagravarr On BEST ANSWER

You'll need to loop over the sites in your freemarker. Assuming you wanted a list of the site names, with commas between them, then your freemarker would instead want to look something like:

<body>
  <#list sites as site>
     ${site.shortName}<#if site_has_next>,</#if>
  </#list>
</body>