Java Mailing List Archive

http://www.junlu.com/

Home » Home (12/2007) » Struts 2 »

logic:iterate, tfoot and sum

Marcello Savino

2006-12-13


Hi, i've a questione regarding sum calculation in a table:
The jsp look like this one:

 <logic:present name="lista">
   <div class="lista"><c:set var="recCount" value="${0}" />
   <table class="scrollable" id="lista"
     <thead>
       <tr>
         <th id="hNr" colspan="2">Nr</th>
         
       </tr>
     </thead>
     <tfoot>
       <tr>
         <td><c:out
value="${recCount}"></c:out></td>
       </tr>
     </tfoot>
     <tbody>
       <logic:iterate id="index" name="lista">
         <c:set var="recCount"
value="${recCount+1}" />
         <tr>
           <td headers="hNr"
class="Numeric"><bean:write
             name="index"
property="number" /></td>
         </tr>
       </logic:iterate>
     </tbody>
   </table>
   </div>
 </logic:present>
</html:form>

Obviously the recCount outputted is 0. To output the right value i have
to put the tfoot after the tbody section but this is not allowed by the
DTD. I would not pre-calculate the rowCount due performance problem.
Does anybody have some ideas to solve this problem ?
Thanks in advance
Ciao, Marcello

---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@(protected)
For additional commands, e-mail: user-help@(protected)

©2008 junlu.com - Jax Systems, LLC, U.S.A.