Book Image

Java EE 5 Development with NetBeans 6

Book Image

Java EE 5 Development with NetBeans 6

Overview of this book

Table of Contents (17 chapters)
Java EE 5 Development with NetBeans 6
Credits
About the Author
About the Reviewers
Preface
Identifying Performance Issues with NetBeans Profiler

Displaying Tabular Data


JavaServer Faces includes the <h:dataTable> tag that makes it easy to iterate through an array or collection of objects. With NetBeans, a data table tag can be added to a page by simply dragging the JSF Data Table item from the NetBeans palette into our page. In order to demonstrate the usage of this tag, let's create a new Web Application project, and add a new JSP named registrationlist.jsp to it.

After dragging the JSF Data Table item into the appropriate location in our registrationlist.jsp page, the following window pops up.

We can either select to create an Empty Table or a Table Generated from an Entity Class.

Note

An Entity Class refers to a Java Persistence API (JPA) entity. We will discuss JPA in detail in Chapter 5 Interacting With Databases through the Java Persistence API.

Selecting to create an empty table generates the following markup in our page:

<h:form>
<h:dataTable value="#{arrayOrCollectionOf}"
var="item">
</h:dataTable>...