Book Image

Mastering JavaServer Faces 2.2

By : Anghel Leonard
Book Image

Mastering JavaServer Faces 2.2

By: Anghel Leonard

Overview of this book

Table of Contents (20 chapters)
Mastering JavaServer Faces 2.2
Credits
About the Author
About the Reviewers
www.PacktPub.com
Preface
The JSF Life Cycle
Index

Iterating with <ui:repeat>


The <ui:repeat> tag is a component handler that is capable of iterating over a collection, and at each iteration, it adds a copy of its child elements in the component tree. We can say that <ui:repeat> acts as a <h:dataTable> tag without rendering an HTML table. Of course, you can do that explicitly, by wrapping its mechanism in a <table>, <tr>, and <td> suite (you will see an example in the upcoming section, Using the jsfc attribute).

It contains a set of very handy attributes that deserve to be mentioned before an example. Besides the well known attributes, value (representing the collection to iterate as java.lang.Object) and var (representing the iterator as java.lang.Object), we have––all the following attributes that are optional:

  • step: This attribute allows us to indicate, as an int value, the number of items that will be skipped for each iteration. By default, the <ui:repeat> tag iterates over each item of the...