Class Table


@Marshalled(typeName="table") public class Table extends HtmlElementContainer<Table>
DTO for an HTML <table> element.

The table element represents data with more than one dimension, in the form of a table. It contains rows and columns of data, with optional headers and footers. The table element is used to display tabular data in a structured format, making it easy to read and understand. It can contain caption, colgroup, thead, tbody, tfoot, and tr elements to organize the table structure.

Examples:

import static org.apache.juneau.bean.html5.HtmlBuilder.*; // Simple table with headers and data Table simple = table( thead( tr( th("Name"), th("Age"), th("City") ) ), tbody( tr( td("John"), td("25"), td("New York") ) ) ); // Table with caption and styling Table styled = table( caption("Employee Information"), thead( tr( th("ID"), th("Name"), th("Department") ) ) ).class_("data-table").border(1); // Table with multiple sections Table complex = new Table() .children( new Caption().children("Sales Report"), new Thead() .children( new Tr() .children( new Th().children("Product"), new Th().children("Q1"), new Th().children("Q2") ) ), new Tbody() .children( new Tr() .children( new Td().children("Widget A"), new Td().children("100"), new Td().children("150") ) ), new Tfoot() .children( new Tr() .children( new Td().children("Total"), new Td().children("100"), new Td().children("150") ) ) );

See Also:
  • Constructor Details

    • Table

      public Table()
      Creates an empty Table element.
    • Table

      public Table(Object... children)
      Creates a Table element with the specified child nodes.
      Parameters:
      children - The child nodes. Must not be null.
  • Method Details

    • border

      public Table border(Object value)
      border attribute.
      Parameters:
      value - The new value for this attribute. Typically a Number or String. Can be null to unset the attribute.
      Returns:
      This object.