I need a while loop within JSTL. I cannot seem to find how to loop over something a specified number of times. Any ideas how I can accomplish this?
I am thinking I could use a forEach but I do not really care to loop over a collection.
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
The
<c:forEach>tag is definitely suitable for this. It hasbeginandendattributes where you can specify the, well, begin and end. It has avarStatusattribute which puts aLoopTagStatusobject in the loop tag scope which in turn has several methods likegetIndex()and on.Here’s a kickoff example: