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:
Hii
I 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}">
&lt;th&gt;&lt;c<img src=../images/dmxzone/forum/icon_smile_shock.gif border=0 align=middle>ut value="${columnName}"/&gt;&lt;/th&gt;
&lt;/c:forEach&gt;

&lt;%-- Get the value of each column while iterating over rows --%&gt;

&lt;c:forEach var="row" items="${sad_doc_rs.rows}"&gt;
&lt;c:set var="t-taxes" value="${((row.total_tax_amount))}"/&gt;

&lt;c:set var="totaltaxes" value="${totaltaxes+t-taxes}"/&gt;
&lt;tr&gt;

&lt;c:forEach var="column" items="${row}"&gt;
&lt;td&gt;&lt;c<img src=../images/dmxzone/forum/icon_smile_shock.gif border=0 align=middle>ut value="${column.value}"/&gt;&lt;/td&gt;

&lt;/c:forEach&gt;
&lt;/tr&gt;
&lt;/c:forEach&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&nbsp;&lt;/td&gt;
&lt;td colspan="2"&gt;&lt;strong&gt;TOTALS&lt;/strong&gt;&lt;/td&gt;
&lt;td width="34%"&gt;&lt;c<img src=../images/dmxzone/forum/icon_smile_shock.gif border=0 align=middle>ut value="${totaltaxes}"/&gt;&lt;/td&gt;

&lt;/tr&gt;
&lt;/table&gt;


Reply to this topic