日期:2014-05-17  浏览次数:20632 次

js 遍历jstl数组
在js中可以
alert(${channel.templates[0].id});
alert(${channel.templates[1].id});
为什么不能对于变量i却不能执行
for(var i=0;i<lenght;i++){
alert(${channel.templates[i].id});
}
js jstl 遍历

------解决方案--------------------
不能这样可以用struts标签
------解决方案--------------------
你要遍历请使用jstl标签
<script>
<c:forEach items="${channel.templates}" var="template">
  alert("${template.id}");
</c:forEach>
</script>
------解决方案--------------------
用的乱了。不是一种循环。/变量都不一样