Developing Web 2.0 applications
with JavaServerFaces
and Dreamweaver
>> Just Became Easier
  1. Introduction
  2. Getting Started
  3. Facelets Concepts
  4. Document Types
  5. Design View
  6. Code View Support
  7. Keyboard Shortcuts
  8. Tag Object Toolbars
  9. Property Inspectors
  10. Facelets Tag Reference
Facelets UI Tag Library
Selected ui:repeat
If you like this documentation, please take a look at my book:

10. Facelets UI Tag Reference

Documentation > Facelets > Facelets Tag Reference > Facelets UI Tag Library > ui:repeat


The UI Repeat tag is used to iterate over a collection of objects exposed to the JSF page as a value-binding EL expression. It is intended as a replacement for the c:forEach tag from the JSTL Core tag library.

You can also use this tag with the "jsfc" feature in Facelets.

JSF Example

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
<html xmlns="" 
<h:head />
		<ui:repeat value="#{productController.products}" var="product">
			<li><h:outputText value="#{}" /></li>
This example was formatted by JSFToolbox for Dreamweaver.

Java Code

package com.mycompany.controller;

import java.util.ArrayList;
import java.util.List;

import javax.faces.bean.ManagedBean;
import javax.faces.bean.RequestScoped;

import com.mycompany.model.Product;

public class ProductController {

	private List<Product> products;

	public List<Product> getProducts() {
		if (products == null) {
			products = new ArrayList<Product>();
			products.add(new Product("Tennis Racket"));
			products.add(new Product("Baseball Bat"));
			products.add(new Product("Hockey Stick"));
		return products;


Rendered Output

Rendered ui:repeat tag

HTML Output

  <li>Tennis Racket</li>
  <li>Baseball Bat</li>
  <li>Hockey Stick</li>

Tag Attributes

offset Text
Read-write property setting the offset from the beginning of the collection from which to start the iteration. If not set, this offset is not considered and iteration will start at the beginning of the collection.
size Text
Read-write property setting the size of the collection to iterate. If this value is less than the actual size of the collection, a FacesException must be thrown.
step Text
Iteration will only process every step items of the collection, starting with the first one.
value Text
The name of a collection of items that this tag iterates over. The collection may be a List, array, java. sql. ResultSet, or an individual java Object. If the collection is null, this tag does nothing.
var Text
Name of the exported scoped variable for the current item of the iteration. This scoped variable has nested visibility. Its type depends on the object of the underlying collection
varStatus Text
Name of the exported request scoped variable for the status of the iteration. Object is a POJO with the following read-only JavaBeans properties. This scoped variable has nested visibility. begin of type Integer end of type Integer index of type int step of type Integer even of type boolean odd of type boolean first of type boolean last of type boolean