0

I have the following situation:

  <s:iterator var="doc" value="docList">
    <tr>
       <td class="lastm">${doc.get("attribute")}</td>
    </tr>
  </s:iterator>

docList is an ArrayList of JSONObjects.

When I load my page I get the following error:

The function get must be used with a prefix when a default namespace is not specified

I've also tried doing
<td class="lastm">${doc.attribute}</td>

but then I get the following error instead:

Property 'attribute' not found on type org.json.JSONObject

What am I doing wrong? The ArrayList has been originally built from a bigger JSONObject that contained the smaller "docs", but I needed an Iterable object to build my table. Is there a better way to do this?

4

2 に答える 2

0

<s:property value="attribute"/>また動作するはずです。

于 2012-04-27T09:08:50.580 に答える
0

I've found a solution.

Instead of using

<s:iterator var="doc" value="docList">
   <tr>
      <td class="lastm">${doc.get("attribute")}</td>
   </tr>
</s:iterator>

I can do

<s:iterator var="doc" value="docList">
   <tr>
      <td class="lastm"><s:property value="#doc.get('attribute')"/></td>
   </tr>
</s:iterator>

Looks like it works!

于 2012-04-27T09:06:17.697 に答える