Forums
This topic is locked
Total in jsp
Posted 01 Aug 2008 16:50:15
1
has voted
01 Aug 2008 16:50:15 connie princess posted:
HiiI am new to java scripting, I have a query that gives me a number of rows and have tabulated results in the following table;But I cant get the totals for the column total_tax_amount which is the sum of amount in the query.
<table width="90%" border="1" align="center" cellpadding="0" cellspacing="0">
<%-- define a variable for total taxes--%>
<c:set var="totaltaxes" value="0"/>
<%-- Get the column names for the header of the table --%>
<c:forEach var="columnName" items="${sad_doc_rs.columnNames}">
<th><c<img src=../images/dmxzone/forum/icon_smile_shock.gif border=0 align=middle>ut value="${columnName}"/></th>
</c:forEach>
<%-- Get the value of each column while iterating over rows --%>
<c:forEach var="row" items="${sad_doc_rs.rows}">
<c:set var="t-taxes" value="${((row.total_tax_amount))}"/>
<c:set var="totaltaxes" value="${totaltaxes+t-taxes}"/>
<tr>
<c:forEach var="column" items="${row}">
<td><c<img src=../images/dmxzone/forum/icon_smile_shock.gif border=0 align=middle>ut value="${column.value}"/></td>
</c:forEach>
</tr>
</c:forEach>
</tr>
<tr>
<td> </td>
<td colspan="2"><strong>TOTALS</strong></td>
<td width="34%"><c<img src=../images/dmxzone/forum/icon_smile_shock.gif border=0 align=middle>ut value="${totaltaxes}"/></td>
</tr>
</table>