This week's book giveaway is in the Servlets forum.
We're giving away four copies of Murach's Java Servlets and JSP and have Joel Murach on-line!
See this thread for details.
The moose likes Struts and the fly likes How can I use struts tag express a loop? Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Murach's Java Servlets and JSP this week in the Servlets forum!
JavaRanch » Java Forums » Frameworks » Struts
Bookmark "How can I use struts tag express a loop?" Watch "How can I use struts tag express a loop?" New topic
Author

How can I use struts tag express a loop?

dragon ji
Ranch Hand

Joined: Oct 31, 2002
Posts: 110
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.


scjp 1.4<br />challenge haven't limit!
Chris Mathews
Ranch Hand

Joined: Jul 18, 2001
Posts: 2712
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

Joined: Oct 31, 2002
Posts: 110
thanx,Chris Mathews.
yeah,JSTL is good for me,I will try it!
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: How can I use struts tag express a loop?
 
Similar Threads
Help using struts tag
Use Struts2 Tag inside custom tag
How to replace a if(boolean) script with struts tag?
popup in struts
question of struts