英文:
Trying to join array of strings, such that they occur in next line using FTL template
问题
以下是要翻译的内容:
这是一个字符串数组,myArray = ["green", "blue", "red"],我想在 HTML 页面上每行显示一个值:
"green"
"blue"
"red"
我尝试了以下方式但没有成功:
英文:
Here is array of strings, myArray = ["green","blue","red"], I want to display each value in next line on html page
"green"
"blue"
"red"
I tried something like below but didnt work.
<td>${myArray?join("\r\n")}</td>
答案1
得分: 0
To show each element on a new line using FTL template you can use the <#list> and
tag for new line. Here is my code:
<#list myArray as item>
${item}
</#list>
英文:
To show each element on a new line using FTL template you can use the <#list> and <br> tag for new line. Here is my code:
<#list myArray as item>
${item}<br>
</#list>
通过集体智慧和协作来改善编程学习和解决问题的方式。致力于成为全球开发者共同参与的知识库,让每个人都能够通过互相帮助和分享经验来进步。
评论