JSF Components in Tables

JSF Components in Tables
  • To this point, we have used only output components in table columns, but you can place any JSF component in a table cell.
  • We use the current integer to configure components in the “Number”, “Textfields”, “Buttons”, and “Menu” columns.
  • Components in a table are no different than components outside a table; 
  • You can manipulate them in any manner you desire, including conditional rendering with the rendered attribute, handling events, and the like.
Editing Tables
  • Editing Table Cells
  • To edit table cells, you provide an input component for the cell you want to edit.
  • You click a checkbox to edit a row and then click the “Save Changes” button to save your changes. 
  • Exa.

Deleting Rows
  • When deleting or adding rows, it would be tedious to use an array to collect the row data. 
  • Use a list instead. 
  • We will simply use an ArrayList in our example.
  • Exa.
Database Tables
  • Databases store information in tables, so the JSF data table component is a good fit for showing data stored in a database. 
  • In this section, we show you how to display the results of a database query.
Table Models
  • When you use a Java object, array, list, result set, or JSTL result object to represent table data, h:dataTable wraps those objects in a model that extends the javax.faces.model.DataModel class. 
  • All of those model classes, listed below, reside in the javax.faces.model package.
    • ArrayDataModel
    • ListDataModel
    • ResultDataModel
    • ResultSetDataModel
    • ScalarDataModel

Thanks a lot for query or your valuable suggestions related to the topic.

Previous Post Next Post

Contact Form