Boa tarde galera estou com um proble, estou tentando somara uns valores de uma consulta em JSP, mais nao estou conseguindo, segue o codgo.
<% while(rs.next())
{
DIA_UTIL = rs.getString("dia_util");
ValorContratado = ValorContratado + rs.getDouble("DESEMBOLSO");
CreditoNovo = CreditoNovo + rs.getDouble("CREDITO_NOVO");
Porcento = Porcento + rs.getDouble("PORCENTO");
AnoMenos1 = AnoMenos1 + rs.getDouble("AnoMenos1");
MesMenos1 = MesMenos1 + rs.getDouble("MesMenos1");
MesMenos2 = MesMenos2 + rs.getDouble("MesMenos2");
MesMenos3 = MesMenos3 + rs.getDouble("MesMenos3");
%>
<tr class="tablin2">
<td><%=rs.getString("dia_util") %></td>
<%if (rs.getDouble("DESEMBOLSO") == 0) {%>
<td>-</td>
<%} else {%>
<td><%=moeda.format(rs.getDouble("DESEMBOLSO")) %> </td>
<% } %>
<%if (rs.getDouble("CREDITO_NOVO") == 0) {%>
<td>-</td>
<%} else {%>
<td><%=moeda.format(rs.getDouble("CREDITO_NOVO")) %> </td>
<% } %>
<%if (rs.getDouble("PORCENTO") == 0) {%>
<td>-</td>
<%} else {%>
<td><%=percentual.format(rs.getDouble("PORCENTO")) %></td>
<% } %>
<%if (rs.getDouble("AnoMenos1") == 0) {%>
<td>-</td>
<%} else {%>
<td><%=moeda.format(rs.getDouble("AnoMenos1")) %></td>
<% } %>
<%if (rs.getDouble("MesMenos1") == 0) {%>
<td>-</td>
<%} else {%>
<td><%=moeda.format(rs.getDouble("MesMenos1")) %></td>
<% } %>
<%if (rs.getDouble("MesMenos2") == 0) {%>
<td>-</td>
<%} else {%>
<td><%=moeda.format(rs.getDouble("MesMenos2")) %></td>
<% } %>
<%if (rs.getDouble("MesMenos3") == 0) {%>
<td>-</td>
<%} else {%>
<td><%=moeda.format(rs.getDouble("MesMenos3")) %></td>
<% } %>
<%} %>
</tr>
<tr id="verde">
<td class="cinza"><b>DIA<br> UTIL</b></td>
<td class="cinza"><b>Valor Total </b></td>
<td class="cinza"><b>Valor Total </b></td>
<td class="cinza"><b>%</b></td>
<td class="cinza"><b>Valor Total</b></td>
<td class="cinza"><b>Valor Total</b></td>
<td class="cinza"><b>Valor Total</b></td>
<td class="cinza"><b>Valor Total</b></td>
</tr>
<% double soma = 0;
for (int i=0; i<tablin2.getColumnCount(); i++) {
DESEMBOLSO = (Double)tablin2.getValueAt(i, 21);
soma+=DESEMBOLSO.doubleValue();
}
(String.valueOf(soma)); %>