This week's book giveaway is in the OCPJP forum.
We're giving away four copies of OCA/OCP Java SE 7 Programmer I & II Study Guide and have Kathy Sierra & Bert Bates on-line!
See this thread for details.
The moose likes JSP and the fly likes Adding the rows in a JSP Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of OCA/OCP Java SE 7 Programmer I & II Study Guide this week in the OCPJP forum!
JavaRanch » Java Forums » Java » JSP
Bookmark "Adding the rows in a JSP" Watch "Adding the rows in a JSP" New topic
Author

Adding the rows in a JSP

Eric Hanson
Greenhorn

Joined: Feb 08, 2006
Posts: 5
Hi,

I have this scenario where i dynamically display the rows on the jsp. Now need to give a row in the end which sums up all the columns in the end which i call the sum row.

How do i get this?

ex: row1 2 2 2
row2 4 4 4
sum 6 6 6

regards,
Eric
karthikeyan Chockalingam
Ranch Hand

Joined: Sep 06, 2003
Posts: 259
Should not the sum row be 3 6 6 6 instead of 6 6 6 ?


http://www.skillassert.com


Eric Hanson
Greenhorn

Joined: Feb 08, 2006
Posts: 5
that is actually

row1 2 2 2

row2 4 4 4

sum 6 6 6

problem with indentation, i think !
Alec Lee
Ranch Hand

Joined: Jan 28, 2004
Posts: 569
You can do simple arithmetic with EL: ${row1 + row2}
Eric Hanson
Greenhorn

Joined: Feb 08, 2006
Posts: 5
But the rows are populated dynamically. I do not know how many rows will be returned at one time. I need to have the sum of all the rows in the end of the page.
Adeel Ansari
Ranch Hand

Joined: Aug 15, 2004
Posts: 2874
Originally posted by Eric Hanson:
But the rows are populated dynamically. I do not know how many rows will be returned at one time. I need to have the sum of all the rows in the end of the page.


http://www.coderanch.com/t/289003/JSP/java/adding-rows-displayed-JSP-as
 
Consider Paul's rocket mass heater.
 
subject: Adding the rows in a JSP