Win a copy of The Java Performance Companion this week in the Performance forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

how to count entries in logic:iterate and display

 
Hubert Pernegger
Ranch Hand
Posts: 49
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
hi,
my following problem is that i iterate over a collection and I want to display the number of the entries



I have tried it with bean:size but it didn't work, i only get the error message that there is no bean for counter, but actually there is one in the proteinPeptideForm
 
Hubert Pernegger
Ranch Hand
Posts: 49
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
ok, I have solved the problem, but I want indexId (that is what I'm using) to start with 1, not with index 0
 
Merrill Higginson
Ranch Hand
Posts: 4864
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You can also use the <bean:size> tag to get the size of a collection.
 
Brent Sterling
Ranch Hand
Posts: 948
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Your bean:size tag looks wrong to me. Try something like this:

<bean:size id="countValue" name="proPep" property="counter"/>
Number of Entries: <bean:write name="countValue"/>

- Brent
 
Merrill Higginson
Ranch Hand
Posts: 4864
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Brent,

I wasn't giving an example of a correctly formatted <bean:size> tag, I was simply making the statement that this tag can be used to get the size of a collection. Naturallly it has to have all the correct attributes in order to work.
 
Brent Sterling
Ranch Hand
Posts: 948
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I was referring to the <bean:size> use in the original post.

- Brent
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic