11-09-2016 03:50 AM
Hello,
I have created a webscript and Java class which return some data.
The data is a JSONObject {"data": [{.....}]) which present an array. So, I want somehow to foreach the data in the html.
1st how I can use this JSONObject which comes from Java in a javascript file and after that to foreach it in some <li> element
2nd If I send from the Java class directly an Array, again how to loop it in the html.
I tried using some Freemarker expressions as below:
<#list data>
<ul>
<#items as item>
<li>${item.name}</li>
</#items>
</ul>
<#else>
<p>Empty</p>
</#list>
But I received the below exception:
freemarker.core.ParseException - Parsing error in template "xxx.post.html.ftl" in line 10, column 22: Encountered ">", but was expecting one of: "as" "." "[" "(" "?" "!" <TERMINATING_EXCLAM> "??" "+" "-" "*" "/" "%" "!=" "=" "==" ">=" <ESCAPED_GTE> ">" <ESCAPED_GT> <LESS_THAN_EQUALS> <LESS_THAN> ".." <AND> <OR>
So obviously I haven't understood the syntax...
Could someone assists in both cases when I have an array and when I have JsonObject to use in js file.
Thank you in advance.
11-09-2016 07:12 AM
Axel Faust Missed character / in the end </#if> tag
<#if items??>
<ul>
<#list items as item>
<li>${item.name}</li>
</#list>
</ul>
<#else>
<p>Empty</p>
</#if>
11-09-2016 07:12 AM
Axel Faust Missed character / in the end </#if> tag
<#if items??>
<ul>
<#list items as item>
<li>${item.name}</li>
</#list>
</ul>
<#else>
<p>Empty</p>
</#if>
Tags
Find what you came for
We want to make your experience in Hyland Connect as valuable as possible, so we put together some helpful links.