我正在使用 JQuery 通过 ajax 调用获取 JSON 对象。JSON 对象包含模型列表(即 Bean)
例如List<myModel>
我正在使用 struts2 json 插件。
作为字符串的 JSON 对象如下所示。
{"myList":[{"age":26,"degree":"MCA","fname":"Pravin","id":1,"lname":"Varpe"},
{"age":26,"degree":"MCA","fname":"Pramod","id":2,"lname":"Patil"},
{"age":24,"degree":"B.E","fname":"Atul","id":3,"lname":"Vairale"},
{"age":22,"degree":"M.E","fname":"Sudeep","id":4,"lname":"Masare"},
{"age":21,"degree":"BCS","fname":"Nikhil","id":1,"lname":"Pethe"},
{"age":21,"degree":"MCS","fname":"Abhijeet","id":1,"lname":"Supekar"}]}
我想将此 JSON 对象传递给<s:iterator>
标记,如下所示
<s:iterator value = "myJsonObject">
<s:property value = "fname"/>
// properties
</s:iterator>
我可以通过将它迭代到 jquery 函数并创建 html 元素来在 jsp 上显示这个 JSON 对象,但我不想这样做。那么是否可以直接将 JSON 传递给<s:iterator>
tag 呢?