• Post Reply Bookmark Topic Watch Topic
  • New Topic

adding rows displayed on JSP as SUM

 
William Moore
Greenhorn
Posts: 5
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi all,

I have a ResultSet returned from the DAO, which i am using to populate the JSP page. Now, what i want is to add the values of the rows that are displayed and show a row called SUM which shows the sum of all the Rows. Any help how i can do that.

For ex:
----------------------------------
Row I | 4 | 7 | 8 | 0 |
----------------------------------
Row II | 4 | 7 | 9 | 5 |
----------------------------------
SUM | 8 | 14 | 17 | 5 |
----------------------------------

Regards,
Bill
 
Adeel Ansari
Ranch Hand
Posts: 2874
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Define one more variable in your TO, lets say it sum. Now sum up the values and place it in that variable.
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!