How to perform addition of data in c:forEach loop

How to perform addition of data in c:forEach loop

As the question suggests I need to know how(or can we?) can we add data in c:forEach loop? I know that c:forEach loop's main functionality is easier display but I am trying to avoid <%%> in jsp.

I am getting data from servlet using Bean concept and displaying it in jsp page using c:forEach

In scriplet tag I used to do the following
view plaincopy to clipboardprint?
Note: Text content in the code blocks is automatically word-wrapped
<%  
for(i=0;i<attributename.size();i++)  
double total=0.0;  
total=total+y;  
%> 
<%
for(i=0;i<attributename.size();i++)
double total=0.0;
total=total+y;
%>
where y is (data coming from database)
So it will keep on adding the values for attributename.size() times.

How can I achieve that with c:forEach?

[Secondary question removed -- please start a new topic for each new question]

<c:set>

${3 + 4} will display 7. Enough of a clue?

Copyright © 2007-2012 www.chuibin.com Chuibin Copyright