The JSF HTML tags can be classified as follows:
Form |
|
Navigation Must be in <form> tag
|
|
Input Must be in <form> tag
|
|
Input Error Messages |
|
Display |
|
Layout and Grouping |
|
Resource Access |
|
The form and navigation tags are described in JSF Navigation.
The input error tags and layout tags are described in Input Error Tags
Three types of tag attributes are shared among multiple HTML component tags:
Basic attributes are shared by the majority of JSF HTML tags.
We have seen several examples of the value attribute, which simply specifies a component's value:<h:inputText value="#{user.name}"/> <h:inputSecret value="#{user.password}"/> <h:commandButton value="Login" action="welcome"/> <h:outputFormat value="#{msgs.currentScore}"> <f:param value="#{quizBean.score}"/> </h:outputFormat>This section also describes the id and rendered basic attributes.
<h:inputText id="name" .../>
<h:message for="name"/>
The id attribute is also useful for:
private UIComponent nameField = new UIInput(); public UIComponent getNameField() { return nameField; } public void setNameField(UIComponent newValue) { nameField = newValue; }Now suppose a JSF page contains an element like:
<h:inputText binding="#{form.nameField}" .../>
The form bean now has access to the UIInput object that
"backs" the h:inputText tag.
(UIInput is a subclass of UIComponent)
Now the entire component object can be manipulated
by the bean (also called a "backing bean").
<h:commandButton ... rendered="#{user.loggedIn}"/>
Here, loggedIn is a boolean property in the user bean.
<h:inputText value="#{form.name.last}" size="25".../>
generates this HTML:
<input type="text" size="25".../>
This section shows the full list of HTML 4.0 pass-through attributes.