How can I calculate the sum in JSP?
You should not calculate the sum in JSP page. Read about MVC (Model-View-Controller). You should not do it in the view, but do it in the model. That means you should do it in the servlet code.
but this code i got in internet and it's input type is "text"
I do not understand. What code are you talking about? Please quote the code here.
Usually a number is stored in a database column of type number or Decimal and not text. So if you retrieve the value, you can directly read it into a long or int variable. If it is text, you can convert it to a long or int with Integer.parseInt() or Long.parseLong().
Then you just sum up all values with sum = sum + newValue
By the way, the attached image is so small and has such a bad resolution that I cannot read anything even if I zoom it.