Java Reference
In-Depth Information
The following table illustrates how tags will be laid out inside a <h:panelGrid> tag.
First Tag
Second Tag
Third Tag
Fourth Tag
Fifth Tag
Sixth Tag
Seventh Tag
Eighth Tag
Ninth Tag
Each row in our <h:panelGrid> consists of an <h:outputLabel> tag, an input field,
and an <h:message> tag.
The columnClasses attribute of <h:panelGrid> allow us to assign CSS styles to each
column inside the panel grid. Its value attribute must consist of a comma separated
list of CSS styles (defined in a CSS stylesheet). The first style will be applied to the
first column, the second style will be applied to the second column, the third style
will be applied to the third column, so on and so forth. If our panel grid had more
than three columns, then the fourth column would have been styled using the first
style in the columnClasses attribute, the fifth column would have been styled using
the second style in the columnClasses attribute, so on and so forth.
The CSS stylesheet for our example is very simple, therefore it is not
shown. However, it is part of the code download for this chapter.
If we wish to style rows in an <h:panelGrid> , we can do so with its rowClasses
attribute, which works the same way that the columnClasses works for columns.
<h:outputLabel> , generates a label for an input field in the form. The value of its
for attribute must match the value of the id attribute of the corresponding
input field.
<h:message> generates an error message for an input field. The value of its for ield
must match the value of the id attribute for the corresponding input field.
The first row in our grid contains an <h:selectOneMenu>. This tag generates an
HTML <select> tag on the rendered page.
Every JSF tag has an id attribute. The value for this attribute must be a string
containing a unique identifier for the tag. If we don't specify a value for this
attribute, one will be generated automatically. It is a good idea to explicitly state
the ID of every component, since this ID is used in runtime error messages (affected
components are a lot easier to identify if we explicitly set their IDs).
 
Search WWH ::




Custom Search