Listing data with dataList

A collection of data in a list layout is presented by dataList with several display types and features, such as AJAX pagination.

How to do it…

A basic definition of a data list with a header facet for listing the names of countries starting with the letter "A" would be as follows:

<p:dataList id="simple" value="#{dataListBean.countriesShort}"
  var="country" itemType="disc">
  <f:facet name="header">
    Countries starting with 'A'
  </f:facet>
  <h:outputText value="#{country}" />
</p:dataList>

By default, the dataList component renders an unordered list, which corresponds to the <ul> HTML tag. The visual output is given here:

How to do it…

The bullet ...

Get PrimeFaces Cookbook - Second Edition now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.