我在jsp页面中使用struts-2 iterator:
<s:iterator var="campListIterator" value="campList">
<h3><s:property /></h3>
<div class="acc">
//Some content
</div>
</s:iterator>但是,我的campList正在开始执行jquery响应。如何使用这个列表进行迭代?
Ajax请求:
$.ajax({
type: "get",
url: "getCampData",
data: {campaignId: campaignId},
dataType: "json"
}).done(function(data) {
alert("Camp List : " + data.campList);
//$('#iterator').val(data.campList);
});发布于 2014-01-09 10:52:37
我可以建议的是,如果您想使用struts-迭代器,就不要通过ajax调用获得结果。您所要做的就是将campList放在ajax调用中的值栈中,当您返回时,将有希望地迭代list。这个教程可能会帮助你实现一个目标。:)
https://stackoverflow.com/questions/21014196
复制相似问题