JSTL forEach List Iteration

JSTL forEach List Iteration Example explains about How to Iterating a List using JSTL Taglib

List is an ordered pair of objects, It may contains duplicates, but it keeps correct the insertion order

Consider a JSP page, which contains a ArrayList with lot of items inside it and we need to iterate and display the items inside that particular ArrayList

You can access an element from this collection using ${item} using a variable var="item"

This JSTL 'c:forEach is available for all the List / Collection implementations in java

Following example shows How to iterate a List using JSTL c:forEach


Please check the table, You can iterate following table items using c:forEach tag

JSTL foreach Collections


You can see Map Iteration here JSTL Map Iteration Example

Required Libraries

You need to download

  1. Tomcat 7
  2. JSTL 1.2

Following jar must be in classpath

  1. jstl-1.2.jar

Project Structure

JSTL forEach List Iteration

1 2 Next

Your email address will not be published. Required fields are marked *