Representation of a simple for loop in JSTL/EL

I need to represent the following for loop (in Java context) in JSTL/EL.

for (int i = 6; i <= 15; i++) {
  System.out.print(i+"/t");
}

It would display the following output.

6      7      8       9       10       11       12       13       14       15

How can I do the same in JSTL/EL? I have no precise idea about it. I’m just trying the following.

<c:forEach begin="6" end="15" varStatus="loop">
    <c:out value="${loop.count}"/>
</c:forEach>

and it would obviously display the following output.

1 2 3 4 5 6 7 8 9 10 

It’s not that I want. I need to display numbers between 6 and 15 (i.e between the specified range). I need to put such a concept to implement paging in my web application. Can I do this using EL?

/t in this statement System.out.print(i+”/t”); is not significant.

python: for loop compact representation

Python, Numpy Is there a more compact way to operate on array elements, without having to use the standard for loop.? For example, consider the function below: filterData(A): B = numpy.zeros(len(A));

Simple loop Ackermann function

How to write the Ackermann function with a simple non-recursive loop?

Simple JS tree data structure representation

I need to build a simple UI for representing a JSON data structure that follows a model similar to: { person1 { name: ‘Dan’, address: { work: ‘9523 Pinehurst’, home: ‘1234 foobar way’ } }, person2 { n

Simple for loop

I have this simple for loop but unfortunately I’m unable to run it successfully. This is what I have: For Loop var imagesPerPage = 2 for (i = 0; i < response.d.length; i++) { if (i > imagesPerP

Simple loop performance issue

Say I have a simple PHP loop like this one // Bad example $array = array(‘apple’,’banana’,’cucumber’); for ($i = 1; $i < count($array); $i++) { echo $array[$i]; } I know this is a bad practice. It

Python: Simple Loop program

So I want to make a simple loop program but I have a problem: def Lottery(): Cash = 200 YourNumber = randint(1, 10) while YourNumber != WinningNumber: Cash = Cash – 10 if Cash < 0: print(You are o

C: How to loop through a binary representation of a number and multiply

I have a long integer (ie 10001000110…) and an array with double values (ie {.5,.76,.34,…}) and I would like to loop through the binary representation of my integer and multiply each each digit wi

simple loop in xslt

Having trouble figuring out a simple XSLT loop that counts and returns the name of the actor. <stars> <star ID=001>Leonardo DiCaprio</star> <star ID=002>Matt Damon</sta

Java simple while loop confusion

I am having trouble with this simple loop for a uni lab. It wont stop looping until I put in a number over a thousand. I can’t see where I have gone wrong on such a simple loop. I have meant to have w

Speed of simple loop [closed]

I have made a simple loop in Java just to test the speed. Compared to the same loop in C it takes a lot more time. 2 billion iterations takes about 6.5 seconds when its executed If its considered to

Answers

I have just come across the following solution.

<c:forEach begin="6" end="15" var="i">
    <c:out value="${i}"/>
</c:forEach>

I have removed the varStatus=”loop” attribute and added the var=”i” attribute. It produces the following output.

6 7 8 9 10 11 12 13 14 15 

Exactly as I wanted. The idea came from here.

The following should work:

<c:forEach begin="6" end="15" var="val">
    <c:out value="${val}"/>
</c:forEach>

Or the following:

<c:forEach begin="6" end="15" varStatus="loop">
    <c:out value="${loop.current}"/>
</c:forEach>

Or the following:

<c:forEach begin="6" end="15" varStatus="loop">
    <c:out value="${loop.index}"/>
</c:forEach>