• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

How can I use struts tag express a loop?

 
dragon ji
Ranch Hand
Posts: 110
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
How can I use struts tag in place of "for(int i=0;i<intSum,i++)",intSum is a variable.
first ,I want to use <logic:iterate...>,but,intSum isn't a collection,how can I do it??please help me ,I don't want write the statement like "<% for(int i,...){%>" in a jsp,thanx.
 
Chris Mathews
Ranch Hand
Posts: 2712
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
This can't be done with the logic:iterate tag, however it is possible using JSTL. The code would look something like the following:

So if you don't mind spending some time learning a new technology then I suggest getting familiar with JSTL. It goes a long way to cleaning up JSP pages and is certainly going to become more widespread as time goes on.
 
dragon ji
Ranch Hand
Posts: 110
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
thanx,Chris Mathews.
yeah,JSTL is good for me,I will try it!
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic