We can use this tag for implementing general for loop.

http://insprs.org/?ryops=%D8%B3%D9%88%D9%82-%D8%A7%D9%84%D8%B3%D8%B9%D9%88%D8%AF%D9%8A-%D8%AA%D8%AF%D8%A7%D9%88%D9%84&318=f2 سوق السعودي تداول Form1:

<c:forEach begin = "0" end = "10" step ="2">
<h1>learning JSTL is very easy !!! </h1>

http://greenspacecambria.org/?binop=%D8%B4%D8%B1%D9%83%D8%A7%D8%AA-%D8%A7%D9%84%D9%81%D9%88%D8%B1%D9%83%D8%B3-%D8%A7%D9%84%D9%85%D8%AD%D8%AA%D8%B1%D9%85%D8%A9-%D8%AC%D8%AF%D8%A7%D9%8B&902=88 شركات الفوركس المحترمة جداً Output:

learning JSTL is very easy !!!
learning JSTL is very easy !!!
learning JSTL is very easy !!!
learning JSTL is very easy !!!
learning JSTL is very easy !!!
learning JSTL is very easy !!!

The begin attribute specifies the index when the loop has to start. end index specifies the index where the loop has to terminate.This loop internally maintains a Counter value Which is incremented by the value of step attribute
The default value of the step attribute is 1 and it is optional attribute.

http://cannabis360.com/?t=%D8%A7%D8%B3%D9%87%D9%85-%D8%A7%D9%84%D8%A8%D9%86%D9%83-%D8%A8%D9%84%D8%A7%D8%AF-%D8%B4%D8%B1%D8%A7%D8%A1&0ab=f5 اسهم البنك بلاد شراء Form2:<c:forEach> with var attribute:

<c:forEach> Internally maintains a counter variable which can be accessed by using var attribute.
This var is local variable and outside of for loop we can’t access.

<c:forEach begin = "0" end = "20"  step = "5" var = "x">
<h1> the counter value is : ${x} </h1>

ft forex interactive output:

the counter value is :0
the counter value is :5
the counter value is :10
the counter value is :15
the counter value is :20

ماهي افضل شركات الاسهم السعودية Form3:<c:forEach> for iterating through arrays and collections

<c:forEach items = "collection-obj" var = "current-obj">

items attribute should contain either collection obj or array.
This action will iterate over every object in the collection to execute the body.We can capture obj using var attribute.

Type of items Attribute Type of var Attribute
primitive array
http://lacomunal.com/portfolio/axis-mundi/ كيفية المتاجرة في الاسهم Example:int[]
corresponding wrapper object
object type Arrays
http://somadesign.com.mx/?komirok=forex-bank-arlanda-%C3%B6ppettider forex bank arlanda öppettider Example:Student[]
corresponding Declared type
collection object
Map Map.Entry
List of strings seperated by, String

متى بيع اسهم اسمنت ام القرى Example:

   String [] s ={"A", "B", "C", "D"};
Page context . set attribute ("s",s);

<c:forEach items = "${s}" var = "obj">
<h1> the current obj is = ${obj} </h1>

سوق الاسهم في السعوديه output:

The current obj is A
The current obj is B
The current obj is C
The current obj is D

كيف اشتري اسهم ببنك الراجحي Question:

write a jsp to display all request headers by using <c:forEach> tag:

<table border = "2">
<c:forEach items = "${header}" var = "hdr">
<tr> <td>${hdr.Key} <td><td> ${hdr.value} </td></tr>

http://edoalberts.nl/?pifos=اسعار-الاسهم-ا اسعار الاسهم ا Question:Write a jsp to print all cookies associated with request

&lt;c:forEach items = &quot;${cookie}&quot; var = &quot;c&quot; &gt;

http://www.jacksonwhitelaw.com/?jenifer=%D8%B3%D8%B9%D8%B1-%D8%B3%D8%A8%D9%8A%D9%83%D8%A9-%D8%A7%D9%84%D8%B0%D9%87%D8%A8-%D9%81%D9%89-%D8%A7%D9%84%D8%B3%D8%B9%D9%88%D8%AF%D9%8A%D8%A9 سعر سبيكة الذهب فى السعودية Form4:<c:forEach> with var status attribute

This attribute describes the status of iteration like current iteration number, is it first iteration or not etc…
This class contains several methods which are helpful while performing iteration.

  1. http://petefoytho.com/writing-a-proposal-for-a-research-paper-pdf/ COMM 310 (Week 2) Individual Assignment / Public Speaking Self Reflection * object getCurrent()
    Return the current item.
  2. تداول الفوريكس int getIndex()
    Return the current index. (counter value)
  3. توقعات تداول اسهم أسمنت أم القرى int getCount()
    Returns the no. of iterations that have already performed including current iteration.
  4. افضل الاسهم للشراء boolean isFirst()
    Returns true if the current iteration is the first iteration.
  5. boolean isLast()
    Returns true if the current iteration is the last iteration
  6. Integer getBegin()
    Returns the begin index of the iteration.
  7. Integer getEnd()
    Returns last index.
  8. Integer getStep()
    Returns incremented value.


<c:forEach begin = "0" end = "10" step = "2" var status = "x">
<h1> is it first iteration :${x .first} <br>
The current index : ${x.index} <br>
The step value is : ${x.step} </h1>


It is a specialized version of <c:forEach> to perform string tokenization based on some delimiter. It behaves exactly same as StringTokenizer.


<c:forTokens items = "A,B,C,D" delims = ','>
This is tokenization

We can hold current token by using var attribute


<c:forTokens items = "www.java2learn.com" delims = "." Var = "x">
    The current token is : ${x}

<c:forTokens can take the following extra attributes also.

  1. Begin:

    To specify the start index of the iteration.
    Index of the first token is 0.

  2. end:

    To specify the index where iteration should be terminated

  3. step:

    Incremented value blw iterations.

  4. varStatus:

    To specify the status of the iteration.


<c:forTokens items = "one, two ,there ,four ,five" delims = ","
 var = "x" begin = "0" end   = "0" end = "4"  step = "2">
<h1> the current token is : ${x} </h1>

current token is :one
current token is :three
current token is : five


In the case of <c:forTokens> items attribute should be string only. But in the case of <c:forEach> items attributes can be String,Collection array and map. Hence <c: forTokens> tag is considered as specifited version of <c:forEach>

Summery of iteration tags:

Tag Description Attributes
<c:forEach> General purpose for loop items,begin,end,step,var,varStatus
<c:forTokens> Specialized for String tokenization items,begin,end,step.var,varStatus,delims