☰ See All Chapters |
JSF panelGrid
<h:panelGrid> element renders as an HTML table with specified number of columns. Children of this element are rendered as cells in the table, filling rows from left to right.
Important Attributes of h:panelGrid
columns: This is an optional attribute. This attribute is used to specify the number of columns in a row.
bgcolor: This is an optional attribute. This attribute specifies the background color code or name for the table.
border: This is an optional attribute. This attribute is used to specify the border's width (in pixels) of table.
cellpadding: This is an optional attribute. This attribute is used to specify the space between cell's contents and its border.
cellspacing: This is an optional attribute. This attribute is used to specify the space should be left between the cells as well as it is also used to specify the space should be left between the right most column and the right side of the table, left most column and the left side of the table and so on for the bottom and top of the table.
width: This is an optional attribute. This attribute is used to specify the border width of the whole table
JSF facet
<f:facet> tag is used to add a facet to the component means this tag is used to add its child as a facet of the closest parent component. With the help of this tag we added header_facet and footer_facet to the container component like panelGroup.
Example for <h:panelGrid>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "https://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="https://www.w3.org/1999/xhtml" xmlns:h="https://java.sun.com/jsf/html" xmlns:f="https://java.sun.com/jsf/core" xmlns:ui="https://java.sun.com/jsf/facelets"> <h:body> <h:panelGrid columns="2" border="1" rules="rows" title="This is facet tag demo"> <f:facet> <h:outputText value="header_facet" /> </f:facet> <h:outputText value="First Name" /> <h:inputText /> <h:outputText value="Last Name" /> <h:inputText /> <h:outputText value="Address" /> <h:inputText /> <h:commandButton value="submit" />
<f:facet> <h:outputText value="footer_facet" /> </f:facet> </h:panelGrid> </h:body> </html> |
All Chapters