Velocity foreach 循环不返回对象的属性
Velocity foreach loop is not returning properties of object
我有一个速度模板 #foreach
循环,它没有返回我试图从中获取它们的对象的预期属性:competitorAttributes
在 ppcThemeData 对象中:
#set($ppcThemeData = {
"competitorAttributes": [
"Save up to 40%",
"Set price of $116",
"6 attractions from a choice of 9",
"3 predetermined attractions",
"Voucher by mail or print",
"Visit attractions for up to 9 days",
"No Hop-On Hop-Off bus tour"
]
}
})
循环遍历每个 属性 创建一个列表项。但是,此循环不会返回 <ul>
内的任何内容。它也不会在控制台中抛出任何错误,并且页面加载没有任何问题。
<ul>
#foreach($competitorAttribute in $pageTheme.competitorattributes)
#set($index = $velocityCount - 1)
<li><span>$competitorAttribute</span></li>
#end
</ul>
$pageTheme.competitorattributes
需要:$pageTheme.competitorAttributes
- A 需要驼峰式。
我有一个速度模板 #foreach
循环,它没有返回我试图从中获取它们的对象的预期属性:competitorAttributes
在 ppcThemeData 对象中:
#set($ppcThemeData = {
"competitorAttributes": [
"Save up to 40%",
"Set price of $116",
"6 attractions from a choice of 9",
"3 predetermined attractions",
"Voucher by mail or print",
"Visit attractions for up to 9 days",
"No Hop-On Hop-Off bus tour"
]
}
})
循环遍历每个 属性 创建一个列表项。但是,此循环不会返回 <ul>
内的任何内容。它也不会在控制台中抛出任何错误,并且页面加载没有任何问题。
<ul>
#foreach($competitorAttribute in $pageTheme.competitorattributes)
#set($index = $velocityCount - 1)
<li><span>$competitorAttribute</span></li>
#end
</ul>
$pageTheme.competitorattributes
需要:$pageTheme.competitorAttributes
- A 需要驼峰式。