x:table

The x:table tag provides JSF developers with the precise control of an HTML table that is lost when using h:panelGroup or h:panelGrid. The x:table tag has attributes similar to the attributes of the HTML table tag. An x:table tag can contain optional x:header and x:footer tags. If either of these tags are used, the body of the table should be enclosed in a x:body tag. The body of the table is created using one or more x:row tags, each of which may contain one or more x:heading or x:column tags.

Attributes
Name Required Request-time Type Description
alignment false false java.lang.String The horizontal alignment of the table on the page. Possible values are "center", "left", and "right".
backgroundColor false false java.lang.String The background color for the table.
borderWidth false false java.lang.String The width of the table border.
cellPadding false false java.lang.String The amount of padding within each table cell.
cellSpacing false false java.lang.String The amount of spacing between each table cell.
height false false java.lang.String The height of the table expressed in pixels or as a portion of the page.
width false false java.lang.String The width of the table expressed in pixels or as a portion of the page.

Inherited Attributes
Core Attributes inherited from AbstractTag

Example

<x:table alignment="center" borderWidth="2">
  <x:row>
    <x:heading>
      <h:outputText value="First Name"/>
    </x:heading>
    <x:heading>
      <h:outputText value="Last Name"/>
    </x:heading>
  </x:row>
  <x:row>
    <x:column>
      <h:outputText value="Mario"/>
    </x:column>
    <x:column>
      <h:outputText value="Andretti"/>
    </x:column>
  </x:row>
  <x:row>
    <x:column>
      <h:outputText value="James"/>
    </x:column>
    <x:column>
      <h:outputText value="Clark"/>
    </x:column>
  </x:row>
  <x:row>
    <x:column>
      <h:outputText value="Emmerson"/>
    </x:column>
    <x:column>
      <h:outputText value="Fittipaldi"/>
    </x:column>
  </x:row>
  <x:row>
    <x:column>
      <h:outputText value="Mika"/>
    </x:column>
    <x:column>
      <h:outputText value="Hakkinen"/>
    </x:column>
  </x:row>
  <x:row>
    <x:column>
      <h:outputText value="Ayrton"/>
    </x:column>
    <x:column>
      <h:outputText value="Senna"/>
    </x:column>
  </x:row>
  <x:row>
    <x:heading>
      <h:outputText value="First Name"/>
    </x:heading>
    <x:heading>
      <h:outputText value="Last Name"/>
    </x:heading>
  </x:row>
</x:table>

The preceeding example produces the following table.

First Name Last Name
Mario Andretti
James Clark
Emmerson Fittipaldi
Mika Hakkinen
Ayrton Senna