How to get comma between Freemarker list

If you use FreeMarker version 2.3.23 or higher, sep tag will work for you:

<#list users as user>
    ${user}<#sep>, </#sep>
</#list>

OR even shorter than that:

<#list users as user>${user}<#sep>, </#list>

This will give exact result

Actually you need to create a variable , then append data in it. e.g <#assign result =""/>

<#assign result =""/>
<#assign seq = ["a", "b", "c", "d"]> // test data for checking output format
<#list seq as x>  
 <#assign result = result+"${x}"/> 
 <#if x_has_next>
  <#assign result = result+","/>
 </#if>
</#list>  
${result}

Result

a,b,c,d

You have to include an <#if value_has_next>,</#if> statement.

This may help:

<#assign seq = ["winter", "spring", "summer", "autumn"]>
<#list seq as x>
  ${x_index + 1}. ${x}<#if x_has_next>,</#if>
</#list>  

will output:

  1. winter,
  2. spring,
  3. summer,
  4. autumn

See this and more examples at:

http://freemarker.org/docs/ref_directive_list.html