我有以下情況:如何使用Struts2從jsp中的JSONObject獲取屬性?
<s:iterator var="doc" value="docList">
<tr>
<td class="lastm">${doc.get("attribute")}</td>
</tr>
</s:iterator>
docList
是一個JSONObjects的ArrayList。
當我打開我的網頁,我得到以下錯誤:
The function get must be used with a prefix when a default namespace is not specified
我也試着做
<td class="lastm">${doc.attribute}</td>
但後來我得到以下錯誤,而不是:
Property 'attribute' not found on type org.json.JSONObject
我在做什麼錯? ArrayList最初是由包含較小「文檔」的較大JSONObject構建的,但我需要一個可用Iterable對象來構建我的表。有一個更好的方法嗎?
否,'
'不起作用 – Kappei 2012-04-27 09:12:33