This week's book giveaway is in the OCMJEA forum.
We're giving away four copies of OCM Java EE 6 Enterprise Architect Exam Guide and have Paul Allen & Joseph Bambara on-line!
See this thread for details.
The moose likes JSP and the fly likes how to do conditional looping?  Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of OCM Java EE 6 Enterprise Architect Exam Guide this week in the OCMJEA forum!
JavaRanch » Java Forums » Java » JSP
Bookmark "how to do conditional looping?  " Watch "how to do conditional looping?  " New topic
Author

how to do conditional looping?

CN
Greenhorn

Joined: Jul 25, 2008
Posts: 6
let say, i have qty. how to loop, as long as qty not equal to 0


<c:set var="i" value="5" />
<c:if test="${i!=0}">
<c:set var="i" value="${i-1}" />

<cut value="${i}" />
</c:if>



the code above only cout 4,
not 4,3,2,1

Please correct my mistake..
I'm using JSTL
Bear Bibeault
Author and ninkuma
Marshal

Joined: Jan 10, 2002
Posts: 61106
    
  66

Originally posted by Chen Nee Lim:
let say, i have qty. how to loop, as long as qty not equal to 0

Please use real words when posting to the forums. Abbreviations such as "qty" in place of whatever it is supposed to stand for (quantity?) only serve to make your posts more difficult to read and less likely to generate useful responses.

Please read this for more information.

thanks,
bear
JavaRanch sheriff


[Asking smart questions] [Bear's FrontMan] [About Bear] [Books by Bear]
Bear Bibeault
Author and ninkuma
Marshal

Joined: Jan 10, 2002
Posts: 61106
    
  66

I see no loop in your code.

Please read this and please read this.
 
Don't get me started about those stupid light bulbs.
 
subject: how to do conditional looping?