Important Notice: Our web hosting provider recently started charging us for additional visits, which was unexpected. In response, we're seeking donations. Depending on the situation, we may explore different monetization options for our Community and Expert Contributors. It's crucial to provide more returns for their expertise and offer more Expert Validated Answers or AI Validated Answers. Learn more about our hosting issue here.

Iterate Increment Hi by default logic:iterate will increment the loop by 1. What do i need to do if i need to increment the loop by 2?

0
Posted

Iterate Increment Hi by default logic:iterate will increment the loop by 1. What do i need to do if i need to increment the loop by 2?

0

Location: http://www.jguru.com/faq/view.jsp?EID=1074765 Created: Apr 9, 2003 Author: Ted Husted (http://www.jguru.com/guru/viewbio.jsp?EID=462042) Question originally posed by Ramesh Shanmugam (http://www.jguru.com/guru/viewbio.jsp?EID=474439 Iterate is not a loop. It passes over the items in a collection. If you don’t want to process all the items, don’t put them in the collection to begin with =:0) Though, you could do something with a scriptlet so that it would not handle some items. <% int i = 0; %> <% i++; if ( i % 2 == 0) { %> <% } else { %> <% } %> In Struts 1.1, there is an indexId bean provided by iterate that you could test instead of rolling your own counter. But this sort of thing is generally not recommended! Your Action should determine precisely what data the page needs and create the appropriate collection for the circumstances. The page should then just be abl

Related Questions

What is your question?

*Sadly, we had to bring back ads too. Hopefully more targeted.

Experts123