File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes JSP and the fly likes Show total of each column Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of EJB 3 in Action this week in the EJB and other Java EE Technologies forum!
JavaRanch » Java Forums » Java » JSP
Bookmark "Show total of each column" Watch "Show total of each column" New topic

Show total of each column

jayalakshmi charugundla
Ranch Hand

Joined: Jul 22, 2009
Posts: 57

I have created one jsp page.In that page i got the data by calling procedure

Here I dont know how to do column of the sum?
The values are coming from the database through procedure.
How to do the total for each column?which logic i have to implement?

Application Status Report

status a1 a2 a3 a4
EAI Account Error -1 3 3 7
EAI Account Error -2 3 5 1
EAI Account Error -3 1 3 1
EAI Account Error -5 1 4 9
Grand Total -11 8 15 18
Christophe Verré

Joined: Nov 24, 2005
Posts: 14687

jayalakshmi charugundla wrote:It's urgent

Please EaseUp and UseAMeaningfulSubjectLine. I've changed the title of your post.

[My Blog]
All roads lead to JavaRanch
xsunil kumar
Ranch Hand

Joined: Dec 14, 2009
Posts: 129
Jaya, i am assuming that your data is coming in loop from the database. So for getting total of any column of data, just define one varaible outside of the loop. For example :-

double sum = 0.0 ;

Now inside the loop.

sum = sum+<amount>

Now just print the value of sum outside the loop.

Hope this will solve your problem.

I agree. Here's the link:
subject: Show total of each column
Similar Threads
Use of Display tags
Can you suggest the best solution for the given scenario?
Hibernate and MySQL Views
column heading dates ...
need help?