Win a copy of The Little Book of Impediments (e-book only) this week in the Agile and Other Processes forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

How to perform addition of data in c:forEach loop?

 
S Shiva
Greenhorn
Posts: 27
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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

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]
 
Bear Bibeault
Author and ninkuma
Marshal
Pie
Posts: 65340
97
IntelliJ IDE Java jQuery Mac Mac OS X
  • Likes 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
<c:set>
 
S Shiva
Greenhorn
Posts: 27
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks... but then how to add? I use ${row.attribute} for display.
Can I add it the same way as in normal for loop?
 
Bear Bibeault
Author and ninkuma
Marshal
Pie
Posts: 65340
97
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
${3 + 4} will display 7. Enough of a clue?
 
S Shiva
Greenhorn
Posts: 27
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks a lot..
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic