1

跨度中未打印总点数

<s:set var="totalSpots" value="0"/>
     <s:iterator var="spotSchedule" value="spotSchedules">
       <s:set var="totalSpots" value="#totalSpots + %{spotSchedule.noOfSpots}" />
     </s:iterator>
<span style='cursor:pointer;text-decoration:underline;padding-left:5px;color:blue;'>
   <s:property value="#totalSpots"/>
</span>
4

1 回答 1

1

使用#符号来引用标签spotSchedule内的<s:iterator>变量。

<s:set var="totalSpots" value="0"/>
  <s:iterator var="spotSchedule" value="spotSchedules">
    <s:set var="totalSpots" value="#totalSpots + #spotSchedule.noOfSpots" />
  </s:iterator>
<span style='cursor:pointer;text-decoration:underline;padding-left:5px;color:blue;'>
   <s:property value="#totalSpots"/>
</span>
于 2013-08-06T12:02:44.177 回答