< Day Day Up > |
A.2 HTML Tag Library ActionsThe HTML library contains action elements that represent JSF components associated with renderers for rendering them as HTML elements. Most of the actions in this library represent the standard concrete HTML component classes, which provide an interface with accessor method for the combination of the generic component type's properties and the attributes supported by the associated renderer. A.2.1 Supported HTML 4.01 AttributesThe JSP actions in the JSF HTML tag library support most attributes that the HTML 4.01 specification declares for the corresponding HTML elements. The individual action descriptions include the supported HTML 4.01 attributes in the syntax section but not in the attributes table. These attributes are instead described in Table A-2. All these attributes are optional and can be set to static values or using any type of JSF EL expression.
This action represents an instance of the component type registered with the type ID javax.faces.Column (by default, an instance of the javax.faces.component.UIColumn class). A component of this type is rendered by its parent so the action doesn't associate the component with a renderer. A column component is used typically as a child of a javax.faces.component.UIData component and represents a single column of tabular data. It can be equipped with a header and a footer facet for a column header and footer. Its children are used to process the column's data. Syntax<h:column [id="id "] [binding="componentBinding "] [rendered="true |false"] > [<f:facet name="header">...</facet>] [<f:facet name="footer">...</facet>] JSF component action elements </h:column> Attributes
Example<h:dataTable value="#{reportHandler.currentReports}" var="report"> <h:column rendered="#{reportHandler.showDate}"> <f:facet name="header"> <h:outputText value="Date" /> </f:facet> <h:outputText value="#{report.date}" /> </h:column> ... </h:dataTable>
This action represents an instance of the component type registered with the type ID javax.faces.HtmlCommandButton (by default, an instance of the javax.faces.component.html.HtmlCommandButton class), combined with a renderer registered with the renderer type ID javax.faces.Button. The component is rendered as an HTML <input> element with the type attribute set to submit, reset, or image (depending on the value of this action element's type and image attribute values), the name attribute set to the component's client ID, and the value attribute set to the component's value. Clicking the rendered button submits the form it belongs to and triggers a javax.faces.event.ActionEvent. Syntax<h:commandButton [id="id "] [binding="componentBinding "] [rendered="true |false"] [value="value "] [type="submit |reset" | image="imageURL "] [action="actionMethodBinding "] [actionListener="actionListenerBinding "] [immediate="true|false "] <!-- HTML attributes --> [accesskey="accessKey "] [alt="altText "] [dir="ltr|rtl"] [disabled="true|false "] [lang="lang "] [onblur="code "] [onchange="code "] [onclick="code "] [ondblclick="code "] [onfocus="code "] [onkeydown="code "] [onkeypress="code "] [onkeyup="code "] [onmousedown="code "] [onmousemove="code "] [onmouseout="code "] [onmouseover="code "] [onmouseup="code "] [onselect="code "] [readonly="true|false "] [style="style "] [styleClass="styleClass "] [tabindex="tabIndex "] [title="title "] /> Attributes
Example<h:form> <h:commandButton value="Save" action="#{formHandler.save}" /> </h:form>
This action represents an instance of the component type registered with the type ID javax.faces.html.HtmlCommandLink (by default, an instance of the javax.faces.component.html.HtmlCommandLink class), combined with a renderer registered with the renderer type ID javax.faces.Link. The component is rendered as an HTML <a> element, an href attribute containing "#", and an onclick attribute containing JavaScript code for submitting the form the component belongs to with the component's client ID as a request parameter. If the component has UIParameter component children, the generated JavaScript code also ensures that each parameter is included as request parameters when the form is submitted, with both the name and value URL encoded. The component's children that are not UIParameter components are rendered as the content of the <a> element, i.e., as the link text or image. Clicking the rendered link submits the form it belongs to and triggers a javax.faces.event.ActionEvent. Syntax<h:commandLink [id="id "] [binding="componentBinding "] [rendered="true |false"] [value="value "] [action="actionMethodBinding "] [actionListener="actionListenerBinding "] [immediate="true|false "] <!-- HTML attributes --> [accesskey="accessKey "] [charset="charset "] [coords="coords "] [dir="ltr|rtl"] [hreflang="lang "] [lang="lang "] [onblur="code "] [ondblclick="code "] [onfocus="code "] [onkeydown="code "] [onkeypress="code "] [onkeyup="code "] [onmousedown="code "] [onmousemove="code "] [onmouseout="code "] [onmouseover="code "] [onmouseup="code "] [rel="rel "] [rev="rev "] [shape="shape "] [style="style "] [styleClass="styleClass "] [tabindex="tabIndex "] [target="target "] [title="title "] [type="contentType "] > [<f:param name="name " value="value " />] JSF component action elements </h:commandLink> Attributes
Example<h:form> <h:commandLink action="#{formHandler.save}"> <hLoutputText value="Save" /> </h:commandLink> </h:form>
This action represents an instance of the component type registered with the type ID javax.faces.HtmlDataTable (by default, an instance of the javax.faces.component.html.HtmlDataTable class), combined with a renderer registered with the renderer type ID javax.faces.Table. The component is rendered as an HTML <table> element. UIColumn child components are responsible for rendering the table columns. The columns can hold any type of component, including input components and command components. The value attribute value can be of any type, but the primary model type is the javax.faces.model.DataModel class (see Appendix B). A value of type Object[] is wrapped automatically in an instance of ArrayDataModel, a java.util.List in a ListDataModel, a javax.servlet.jsp.jstl.sql.Result in a ResultDataModel, a java.sql.ResultSet in a ResultSetDataModel, and any other type in a ScalarDataModel. Both the data table component and its column children may be equipped with header and footer facets. The table's header facet is rendered as one <th> element (with a colspan attribute set to the number of children) within a <tr> element, and column header facets are rendered as <th> elements within a separate <tr> element. A <thead> element encloses both header <tr> elements. The footer facets, if any, are rendered in a similar manner, but with <td> elements instead of <th> and a <tfoot> element instead of the <thead> element. CSS style classes for the header and footer cells can be specified by the headerClass and footerClass attributes. The table rows are rendered within a <tbody> element, with a <tr> element for each row and a <td> element for each column child. The first row to render and how many rows to render can be specified by the first and rows attributes, and CSS style classes for the rows and cells can be specified by the rowClasses and columnClasses attributes. Syntax<h:dataTable [id="id "] [binding="componentBinding "] [rendered="true |false"] [value="value "] [var="var "] [first="first "] [rows="rows "] [headerClass="styleClass "] [footerClass="styleClass "] [rowClasses="styleClasses "] [columnClasses="styleClasses "] <!-- HTML attributes --> [bgcolor="color "] [border="border "] [cellpadding="padding "] [cellspacing="spacing "] [dir="ltr|rtl"] [frame="frame "] [lang="lang "] [onclick="code "] [ondblclick="code "] [onkeydown="code "] [onkeypress="code "] [onkeyup="code "] [onmousedown="code "] [onmousemove="code "] [onmouseout="code "] [onmouseover="code "] [onmouseup="code "] [rules="rules "] [style="style "] [styleClass="styleClass "] [summary="summary "] [title="title "] [width="width "] > [<f:facet name="header">...</facet>] [<f:facet name="footer">...</facet>] <h:column> JSF component action elements </h:column> </h:dataTable> Attributes
Example<h:dataTable value="#{reportHandler.currentReports}" var="report"> <f:facet name="header"> <h:outputText value="Expense Reports" /> </f:facet> <h:column rendered="#{reportHandler.showDate}"> <f:facet name="header"> <h:outputText value="Date" /> </f:facet> <h:outputText value="#{report.date}" /> </h:column> ... </h:dataTable>
This action represents an instance of the component type registered with the type ID javax.faces.HtmlForm (by default, an instance of the javax.faces.component.html.HtmlForm class), combined with a renderer registered with the renderer type ID javax.faces.Form. The component is rendered as an HTML <form> element with an action attribute set to a URL that identifies the view containing the form and a method attribute set to post. When the form is submitted, only components that are children of the submitted form are processed. Syntax<h:form [id="id "] [binding="componentBinding "] [rendered="true |false"] <!-- HTML attributes --> [accept="contentTypes "] [acceptcharset="charEncodings "] [enctype="encType "] [dir="ltr|rtl"] [lang="lang "] [onclick="code "] [ondblclick="code "] [onkeydown="code "] [onkeypress="code "] [onkeyup="code "] [onmousedown="code "] [onmousemove="code "] [onmouseout="code "] [onmouseover="code "] [onmouseup="code "] [onreset="code "] [onsubmit="code "] [style="style"] [styleClass="styleClass"] [target="target "] [title="title "] > JSF component action elements </h:form> Attributes
Example<h:form> <h:panelGrid columns="2"> <h:outputText value="First name:" /> <h:inputText value="#{user.firstName}" /> <h:outputText value="Last name:" /> <h:inputText value="#{user.lastName}" /> </h:panelGrid> </h:form>
This action represents an instance of the component type registered with the type ID javax.faces.HtmlGraphicImage (by default, an instance of the javax.faces.component.html.HtmlGraphicImage class), combined with a renderer registered with the renderer type ID javax.faces.Image. The component is rendered as an HTML <img> element with a src attribute holding the component's value or the url attribute value, adjusted to a context-relative path if it starts with a slash and with encoded session ID information if necessary. Syntax<h:graphicImage [id="id "] [binding="componentBinding "] [rendered="true |false"] [value="value " | url="imageURL "] <!-- HTML attributes --> [alt="altText "] [dir="ltr|rtl"] [height="height "] [ismap="true|false "] [lang="lang "] [longdesc="descURI"] [onclick="code "] [ondblclick="code "] [onkeydown="code "] [onkeypress="code "] [onkeyup="code "] [onmousedown="code "] [onmousemove="code "] [onmouseout="code "] [onmouseover="code "] [onmouseup="code "] [style="style "] [styleClass="styleClass "] [title="title "] [usemap="mapName "] [width="width "] /> Attributes
Example<h:graphicImage value="/images/folder-open.gif" />
This action represents an instance of the component type registered with the type ID javax.faces.HtmlInputHidden (by default, an instance of the javax.faces.component.html.HtmlInputHidden class), combined with a renderer registered with the renderer type ID javax.faces.Hidden. The component is rendered as an HTML <input> element with a type attribute set to hidden, a name attribute set to the component's client ID and a value attribute set to the component's value. Syntax<h:inputHidden [id="id "] [binding="componentBinding "] [rendered="true |false"] [value="value "] [converter="converter "] [required="true|false "] [validator="validatorMethod "] [valueChangeListener="listenerMethod "] [immediate="true|false "] /> Attributes
Example<h:form> <h:inputHidden value="#{user.type}" /> </h:form>
This action represents an instance of the component type registered with the type ID javax.faces.HtmlInputSecret (by default, an instance of the javax.faces.component.html.HtmlInputSecret class), combined with a renderer registered with the renderer type ID javax.faces.Secret. The component is rendered as an HTML <input> element with a type attribute set to password, a name attribute set to the component's client ID and a value attribute set to the component's value only if the action's redisplay attribute is set to true. Syntax<h:inputSecret [id="id "] [binding="componentBinding "] [rendered="true |false"] [value="value "] [redisplay="true|false "] [converter="converter "] [required="true|false "] [validator="validatorMethod "] [valueChangeListener="listenerMethod "] [immediate="true|false "] <!-- HTML attributes --> [accesskey="accessKey "] [alt="altText "] [dir="ltr|rtl"] [disabled="true|false "] [lang="lang "] [maxlength="maxLength "] [onblur="code "] [onchange="code "] [onclick="code "] [ondblclick="code "] [onfocus="code "] [onkeydown="code "] [onkeypress="code "] [onkeyup="code "] [onmousedown="code "] [onmousemove="code "] [onmouseout="code "] [onmouseover="code "] [onmouseup="code "] [onselect="code "] [readonly="true|false "] [size="size"] [style="style "] [styleClass="styleClass "] [tabindex="tabIndex "] [title="title "] /> Attributes
Example<h:form>
<h:inputSecret value="#{user.password}" />
</h:form>
This action represents an instance of the component type registered with the type ID javax.faces.HtmlInputText (by default, an instance of the javax.faces.component.html.HtmlInputText class), combined with a renderer registered with the renderer type ID javax.faces.Text. The component is rendered as an HTML <input> element with a type attribute set to text, a name attribute set to the component's client ID, and a value attribute set to the component's value. Syntax<h:inputText [id="id "] [binding="componentBinding "] [rendered="true |false"] [value="value "] [converter="converter "] [required="true|false "] [validator="validatorMethod "] [valueChangeListener="listenerMethod "] [immediate="true|false "] <!-- HTML attributes --> [accesskey="accessKey "] [alt="altText "] [dir="ltr|rtl"] [disabled="true|false "] [lang="lang "] [maxlength="maxLength "] [onblur="code "] [onchange="code "] [onclick="code "] [ondblclick="code "] [onfocus="code "] [onkeydown="code "] [onkeypress="code "] [onkeyup="code "] [onmousedown="code "] [onmousemove="code "] [onmouseout="code "] [onmouseover="code "] [onmouseup="code "] [onselect="code "] [readonly="true|false "] [size="size"] [style="style "] [styleClass="styleClass "] [tabindex="tabIndex "] [title="title "] /> Attributes
Example<h:form>
<h:inputText value="#{user.email}" />
</h:form>
This action represents an instance of the component type registered with the type ID javax.faces.HtmlInputTextarea (by default, an instance of the javax.faces.component.html.HtmlInputTextarea class), combined with a renderer registered with the renderer type ID javax.faces.Textarea. The component is rendered as an HTML <textarea> element with a name attribute set to the component's client ID and a body holding the component's value. Syntax<h:inputTextarea [id="id "] [binding="componentBinding "] [rendered="true |false"] [value="value "] [converter="converter "] [required="true|false "] [validator="validatorMethod "] [valueChangeListener="listenerMethod "] [immediate="true|false "] <!-- HTML attributes --> [accesskey="accessKey "] [cols="noOfCols "] [dir="ltr|rtl"] [disabled="true|false "] [lang="lang "] [onblur="code "] [onchange="code "] [onclick="code "] [ondblclick="code "] [onfocus="code "] [onkeydown="code "] [onkeypress="code "] [onkeyup="code "] [onmousedown="code "] [onmousemove="code "] [onmouseout="code "] [onmouseover="code "] [onmouseup="code "] [onselect="code "] [readonly="true|false "] [rows="noOfRows "] [style="style "] [styleClass="styleClass "] [tabindex="tabIndex "] [title="title "] /> Attributes
Example<h:form>
<h:inputTextarea value="#{user.bio}" />
</h:form>
This action represents an instance of the component type registered with the type ID javax.faces.HtmlMessage (by default, an instance of the javax.faces.component.html.HtmlMessage class), combined with a renderer registered with the renderer type ID javax.faces.Message. The component gets the first message queued for the component identified by the for attribute. The message properties identified by the showDetail and showSummary attributes for this message are rendered as text, within an HTML <span> element if any of the CSS style attributes apply or the id attribute is set. If the tooltip attribute is set to true and both the summary and the detailed text are rendered, the message summary is rendered as the value of the <span> element's title attribute. Syntax<h:message for="componentId " [id="id "] [binding="componentBinding "] [rendered="true |false"] [showDetail="true |false"] [showSummary="true|false "] [tooltip="true|false "] [errorClass="styleClass "] [errorStyle="style "] [fatalClass="styleClass "] [fatalStyle="style "] [infoClass="styleClass "] [infoStyle="style "] [warnClass="styleClass "] [warnStyle="style "] <!-- HTML attributes --> [style="style "] [styleClass="styleClass "] [title="title "] /> Attributes
Example<h:form>
<h:inputText id="firstName" value="#{user.firstName}" />
<h:message for="firstName" errorStyle="color: red" />
</h:form>
This action represents an instance of the component type registered with the type ID javax.faces.HtmlMessages (by default, an instance of the javax.faces.component.html.HtmlMessages class), combined with a renderer registered with the renderer type ID javax.faces.Messages. The component receives all queued messages or only those queued without a component identifier if the globalOnly attribute is set to true. The message properties identified by the showDetail and showSummary attributes are rendered as cells in an HTML table if the layout attribute is set to table; otherwise within an HTML <span> element if any of the CSS style attributes apply or the id attribute is set. If the tooltip attribute is set to true and both the summary and the detailed text are rendered, the message summary is rendered as the value of the <td> or <span> element's title attribute. Syntax<h:messages [id="id "] [binding="componentBinding "] [rendered="true |false"] [globalOnly="true|false "] [layout="list |table"] [showDetail="true|false "] [showSummary="true |false"] [tooltip="true|false "] [errorClass="styleClass "] [errorStyle="style "] [fatalClass="styleClass "] [fatalStyle="style "] [infoClass="styleClass "] [infoStyle="style "] [warnClass="styleClass "] [warnStyle="style "] <!-- HTML attributes --> [style="style "] [styleClass="styleClass "] [title="title "] /> Attributes
Example<!-- Render summaries for all messages at the top of the page -->
<h:messages/>
<h:form>
<h:inputText id="firstName" value="#{user.firstName}" />
<!-- Render details per component next to the field -->
<h:message for="firstName" errorStyle="color: red" />
</h:form>
This action represents an instance of the component type registered with the type ID javax.faces.HtmlOutputFormat (by default, an instance of the javax.faces.component.html.HtmlOutputFormat class), combined with a renderer registered with the renderer type ID javax.faces.Format. The component is rendered as text, within an HTML <span> element if any of the CSS style attributes apply or the id attribute is set. The component's value should be a parameterized message string. An Object[] is created from the component's UIParameter children and passed along with the components value as arguments to the java.text.MessageFormat format( ) method to format a message, which is rendered. Syntax<h:outputFormat [id="id "] [binding="componentBinding "] [rendered="true |false"] [value="value "] [converter="converter "] [escape="true |false"] <!-- HTML attributes --> [style="style "] [styleClass="styleClass "] [title="title "] > <f:param value="value " /> </h:outputFormat> Attributes
Example<f:loadBundle basename="messages" var="msgs" /> <h:outputFormat value="#{msgs.sunRiseAndSetText}"> <f:param value="#{city.sunRiseTime}" /> <f:param value="#{city.sunSetTime}" /> </h:outputFormat>
This action represents an instance of the component type registered with the type ID javax.faces.HtmlOutputLabel (by default, an instance of the javax.faces.component.html.HtmlOutputLabel class), combined with a renderer registered with the renderer type ID javax.faces.Label. The component is rendered as an HTML <label> element with a for attribute set to the client ID for the component identified by the action element's for attribute value. The <label> element body is generated from the <h:outputLabel> element's body. While the <h:outputLabel> element supports a value attribute, it's ignored by the JSF 1.0 reference implementation, but other implementations may respect it and use it as the <label> body.
Syntax<h:outputLabel for="componentId " [id="id "] [binding="componentBinding "] [rendered="true |false"] [value="value "] [converter="converter "] <!-- HTML attributes --> [accesskey="accessKey "] [dir="ltr|rtl"] [lang="lang "] [onblur="code "] [onchange="code "] [onclick="code "] [ondblclick="code "] [onfocus="code "] [onkeydown="code "] [onkeypress="code "] [onkeyup="code "] [onmousedown="code "] [onmousemove="code "] [onmouseout="code "] [onmouseover="code "] [onmouseup="code "] [style="style "] [styleClass="styleClass "] [tabindex="tabIndex "] [title="title "] > JSF component action elements or non-JSF content </h:outputLabel> Attributes
Example<h:inputText id="firstName" value="#{user.firstName}" />
<h:outputLabel for="firstName" />
This action represents an instance of the component type registered with the type ID javax.faces.HtmlOutputLink (by default, an instance of the javax.faces.component.html.HtmlOutputLink class), combined with a renderer registered with the renderer type ID javax.faces.Link. The component is rendered as an HTML <a> element with an href attribute set to the component's value. If the component has UIParameter component children, their name and value properties are added as query string parameters to the href attribute value, with both the name and value URL encoded. The component's children that are not UIParameter components are rendered as the content of the <a> element, i.e., as the link text or image. Syntax<h:outputLink [id="id "] [binding="componentBinding "] [rendered="true |false"] [value="value "] [converter="converter "] <!-- HTML attributes --> [accesskey="accessKey "] [charset="charset "] [coords="coords "] [dir="ltr|rtl"] [hreflang="lang "] [lang="lang "] [onblur="code "] [onclick="code "] [ondblclick="code "] [onfocus="code "] [onkeydown="code "] [onkeypress="code "] [onkeyup="code "] [onmousedown="code "] [onmousemove="code "] [onmouseout="code "] [onmouseover="code "] [onmouseup="code "] [rel="rel "] [rev="rev "] [shape="shape "] [style="style "] [styleClass="styleClass "] [tabindex="tabIndex "] [target="target "] [title="title "] [type="contentType "] > [<f:param name="name " value="value " />] JSF component action elements </h:outputLink> Attributes
Example<h:outputLink value="../../logout.jsp" />
This action represents an instance of the component type registered with the type ID javax.faces.HtmlOutputText (by default, an instance of the javax.faces.component.html.HtmlOutputText class), combined with a renderer registered with the renderer type ID javax.faces.Text. The component is rendered as text, within an HTML <span> element if any of the HTML attributes or the id attribute is set. Syntax<h:outputText [id="id "] [binding="componentBinding "] [rendered="true |false"] [value="value "] [converter="converter "] [escape="true |false"] <!-- HTML attributes --> [style="style "] [styleClass="styleClass "] [title="title "] /> Attributes
Example<h:outputText value="#{user.name}" />
This action represents an instance of the component type registered with the type ID javax.faces.HtmlPanelGrid (by default, an instance of the javax.faces.component.html.HtmlPanelGrid class), combined with a renderer registered with the renderer type ID javax.faces.Grid. The component is rendered as an HTML table with the number of columns specified by the columns attribute. The component's children are used to render the table cells, with new rows as the number of columns is reached. The panel component may be equipped with a header and a footer facet. The table's header facet is rendered as one <th> element (with a colspan attribute set to the value of the columns attribute) within a <tr> element, enclosed within an <thead> element. The footer facet is rendered in a similar manner, but with a <td> element instead of <th> and a <tfoot> element instead of the <thead> element. CSS style classes for the header and footer cells can be specified by the headerClass and footerClass attributes. The table rows are rendered within a <tbody> element, with a <tr> element for each row and a <td> element for each column. CSS style classes for the rows and cells can be specified by the rowClasses and columnClasses attributes. Syntax<h:panelGrid [id="id "] [binding="componentBinding "] [rendered="true |false"] [columns="noOfColumns "] [headerClass="styleClass "] [footerClass="styleClass "] [rowClasses="styleClasses "] [columnClasses="styleClasses "] <!-- HTML attributes --> [bgcolor="color "] [border="border "] [cellpadding="padding "] [cellspacing="spacing "] [dir="ltr|rtl"] [frame="frame "] [lang="lang "] [onclick="code "] [ondblclick="code "] [onkeydown="code "] [onkeypress="code "] [onkeyup="code "] [onmousedown="code "] [onmousemove="code "] [onmouseout="code "] [onmouseover="code "] [onmouseup="code "] [rules="rules "] [style="style "] [styleClass="styleClass "] [summary="summary "] [title="title "] [width="width "] > [<f:facet name="header">...</facet>] [<f:facet name="footer">...</facet>] JSF component action elements </h:panelGrid> Attributes
Example<h:form> <h:panelGrid columns="2"> <h:outputText value="First name:" /> <h:inputText value="#{user.firstName}" /> <h:outputText value="Last name:" /> <h:inputText value="#{user.lastName}" /> </h:panelGrid> </h:form>
This action represents an instance of the component type registered with the type ID javax.faces.HtmlPanelGroup (by default, an instance of the javax.faces.component.html.HtmlPanelGroup class), combined with a renderer registered with the renderer type ID javax.faces.Group. The component acts as a container for other components in situations where only one component is allowed, e.g., when a group of components is used as a facet. It renders its children, within an HTML <span> element if any of the HTML attributes or the id attribute is set. Syntax<h:panelGroup [id="id "] [binding="componentBinding "] [rendered="true |false"] <!-- HTML attributes --> [style="style "] [styleClass="styleClass "] > JSF component action elements </h:panelGroup> Attributes
Example<h:form> <h:panelGrid columns="2"> <f:facet name="header"> <h:panelGroup> <h:outputText value="Sales stats for " /> </h:outputText value="#{sales.region}" style="font-weight: bold" /> </h:panelGroup> </f:facet> <h:outputText value="January" /> <h:inputText value="#{sales.jan}" /> <h:outputText value="February" /> <h:inputText value="#{sales.feb}" /> ... </h:panelGrid> </h:form>
This action represents an instance of the component type registered with the type ID javax.faces.HtmlSelectBooleanCheckbox (by default, an instance of the javax.faces.component.html.HtmlSelectBooleanCheckbox class), combined with a renderer registered with the renderer type ID javax.faces.Checkbox. The component is rendered as an HTML <input> element with a type attribute set to checkbox and a name attribute set to the component's client ID. If the component's value is true, a checked attribute is rendered as well. Syntax<h:selectBooleanCheckbox [id="id "] [binding="componentBinding "] [rendered="true |false"] [value="value "] [converter="converter "] [required="true|false "] [validator="validatorMethod "] [valueChangeListener="listenerMethod "] [immediate="true|false "] <!-- HTML attributes --> [accesskey="accessKey "] [dir="ltr|rtl"] [disabled="true|false "] [lang="lang "] [onblur="code "] [onchange="code "] [onclick="code "] [ondblclick="code "] [onfocus="code "] [onkeydown="code "] [onkeypress="code "] [onkeyup="code "] [onmousedown="code "] [onmousemove="code "] [onmouseout="code "] [onmouseover="code "] [onmouseup="code "] [onselect="code "] [readonly="true|false "] [style="style "] [styleClass="styleClass "] [tabindex="tabIndex "] [title="title "] /> Attributes
Example<h:form>
<h:selectBooleanCheckbox value="#{user.vip}" />
</h:form>
This action represents an instance of the component type registered with the type ID javax.faces.HtmlSelectManyCheckbox (by default, an instance of the javax.faces.component.html.HtmlSelectManyCheckbox class), combined with a renderer registered with the renderer type ID javax.faces.Checkbox. The component is rendered as an HTML <table> element with an <input> element for each choice represented by its children (one or more UISelectItem and UISelectItems components) as the table cells. If the layout attribute is set to pageDirection, each cell is rendered in a separate table row; otherwise all cells are rendered in one row. A UISelectItemGroup child component is rendered as a nested table within the corresponding outer table cell. If the id attribute is set, a <span> element with an id attribute containing the component's client ID is rendered around the outer table. The <input> elements are rendered with a type attribute set to checkbox and a name attribute set to the component's client ID. Each <input> element is nested also within a <label> elements with a for attribute set to the component's client ID. For all choices that match one of the component's values, the checked attribute is set for the corresponding <input> element. Syntax<h:selectManyCheckbox [id="id "] [binding="componentBinding "] [rendered="true |false"] [value="value "] [converter="converter "] [required="true|false "] [validator="validatorMethod "] [valueChangeListener="listenerMethod "] [immediate="true|false "] [disabledClass="styleClass "] [enabledClass="styleClass "] [layout="lineDirection |pageDirection"] <!-- HTML attributes --> [accesskey="accessKey "] [border="border "] [dir="ltr|rtl"] [disabled="true|false "] [lang="lang "] [onblur="code "] [onchange="code "] [onclick="code "] [ondblclick="code "] [onfocus="code "] [onkeydown="code "] [onkeypress="code "] [onkeyup="code "] [onmousedown="code "] [onmousemove="code "] [onmouseout="code "] [onmouseover="code "] [onmouseup="code "] [onselect="code "] [readonly="true|false "] [style="style "] [styleClass="styleClass "] [tabindex="tabIndex "] [title="title "] > <f:selectItem> and/or <f:selectItems> action elements </h:selectManyCheckbox> Attributes
Example<h:form> <h:selectManyCheckbox value="#{user.projects}"> <f:selectItems value="#{allProjects}" /> </h:selectManyCheckbox> </h:form>
This action represents an instance of the component type registered with the type ID javax.faces.HtmlSelectManyListbox (by default, an instance of the javax.faces.component.html.HtmlSelectManyListbox class), combined with a renderer registered with the renderer type ID javax.faces.Listbox. The component is rendered as an HTML <select> element with a name attribute set to the component's client ID and a multiple attribute. If the size attribute is set, it is added to the <select> element with the specified value; otherwise a size attribute with the number of choices as the value is added. Each choice represented by the component's children (one or more UISelectItem and UISelectItems components) is rendered as an <option> element or as an <optgroup> element if the child is of the UISelectItemGroup subtype. For all choices that match one of the component's values, the selected attribute is set for the corresponding <option> element. If a choice is marked as disabled, the disabled attribute is also added. Syntax<h:selectManyListbox [id="id "] [binding="componentBinding "] [rendered="true |false"] [value="value "] [converter="converter "] [required="true|false "] [validator="validatorMethod "] [valueChangeListener="listenerMethod "] [immediate="true|false "] <!-- HTML attributes --> [accesskey="accessKey "] [dir="ltr|rtl"] [disabled="true|false "] [lang="lang "] [onblur="code "] [onchange="code "] [onclick="code "] [ondblclick="code "] [onfocus="code "] [onkeydown="code "] [onkeypress="code "] [onkeyup="code "] [onmousedown="code "] [onmousemove="code "] [onmouseout="code "] [onmouseover="code "] [onmouseup="code "] [onselect="code "] [readonly="true|false "] [size="size"] [style="style "] [styleClass="styleClass "] [tabindex="tabIndex "] [title="title "] > <f:selectItem> and/or <f:selectItems> action elements </h:selectManyListbox> Attributes
Example<h:form> <h:selectManyListbox value="#{user.projects}"> <f:selectItems value="#{allProjects}" /> </h:selectManyListbox> </h:form>
This action represents an instance of the component type registered with the type ID javax.faces.HtmlSelectManyMenu (by default, an instance of the javax.faces.component.html.HtmlSelectManyMenu class), combined with a renderer registered with the renderer type ID javax.faces.Menu. The component is rendered as an HTML <select> element with a name attribute set to the component's client ID and a multiple attribute and a size attribute with 1 as the value. Each choice represented by the component's children (one or more UISelectItem and UISelectItems components) is rendered as an <option> element or as an <optgroup> element if the child is of the UISelectItemGroup subtype. For all choices that match one of the component's values, the selected attribute is set for the corresponding <option> element. If a choice is marked as disabled, the disabled attribute is also added. Syntax<h:selectManyMenu [id="id "] [binding="componentBinding "] rendered="true |false"] [value="value "] [converter="converter "] [required="true|false "] [validator="validatorMethod "] [valueChangeListener="listenerMethod "] [immediate="true|false "] <!-- HTML attributes --> [accesskey="accessKey "] [dir="ltr|rtl"] [disabled="true|false "] [lang="lang "] [onblur="code "] [onchange="code "] [onclick="code "] [ondblclick="code "] [onfocus="code "] [onkeydown="code "] [onkeypress="code "] [onkeyup="code "] [onmousedown="code "] [onmousemove="code "] [onmouseout="code "] [onmouseover="code "] [onmouseup="code "] [onselect="code "] [readonly="true|false "] [style="style "] [styleClass="styleClass "] [tabindex="tabIndex "] [title="title "] > <f:selectItem> and/or <f:selectItems> action elements </h:selectManyMenu> Attributes
Example<h:form> <h:selectManyMenu value="#{user.projects}"> <f:selectItems value="#{allProjects}" /> </h:selectManyMenu> </h:form>
This action represents an instance of the component type registered with the type ID javax.faces.HtmlSelectOneListbox (by default, an instance of the javax.faces.component.html.HtmlSelectOneListbox class), combined with a renderer registered with the renderer type ID javax.faces.Listbox. The component is rendered as an HTML <select> element with a name attribute set to the component's client ID. If the size attribute is set, it is added to the <select> element with the specified value; otherwise a size attribute with the number of choices as the value is added. Each choice represented by the component's children (one or more UISelectItem and UISelectItems components) is rendered as an <option> element or as an <optgroup> element if the child is of the UISelectItemGroup subtype. For all choices that match one of the component's values, the selected attribute is set for the corresponding <option> element. If a choice is marked as disabled, the disabled attribute is also added. Syntax<h:selectOneListbox [id="id "] [binding="componentBinding "] [rendered="true |false"] [value="value "] [converter="converter "] [required="true|false "] [validator="validatorMethod "] [valueChangeListener="listenerMethod "] [immediate="true|false "] <!-- HTML attributes --> [accesskey="accessKey "] [dir="ltr|rtl"] [disabled="true|false "] [lang="lang "] [onblur="code "] [onchange="code "] [onclick="code "] [ondblclick="code "] [onfocus="code "] [onkeydown="code "] [onkeypress="code "] [onkeyup="code "] [onmousedown="code "] [onmousemove="code "] [onmouseout="code "] [onmouseover="code "] [onmouseup="code "] [onselect="code "] [readonly="true|false "] [size="size"] [style="style "] [styleClass="styleClass "] [tabindex="tabIndex "] [title="title "] > <f:selectItem> and/or <f:selectItems> action elements </h:selectOneListbox> Attributes
Example<h:form> <h:selectOneListbox value="#{user.country}"> <f:selectItems value="#{allCountries}" /> </h:selectOneListbox> </h:form>
This action represents an instance of the component type registered with the type ID javax.faces.HtmlSelectOneMenu (by default, an instance of the javax.faces.component.html.HtmlSelectOneMenu class), combined with a renderer registered with the renderer type ID javax.faces.Menu. The component is rendered as an HTML <select> element with a name attribute set to the component's client ID, and a multiple attribute and a size attribute with 1 as the value. Each choice represented by the component's children (one or more UISelectItem and UISelectItems components) is rendered as an <option> element or as an <optgroup> element if the child is of the UISelectItemGroup subtype. For all choices that match one of the component's values, the selected attribute is set for the corresponding <option> element. If a choice is marked as disabled, the disabled attribute is also added. Syntax<h:selectOneMenu [id="id "] [binding="componentBinding "] [rendered="true |false"] [value="value "] [converter="converter "] [required="true|false "] [validator="validatorMethod "] [valueChangeListener="listenerMethod "] [immediate="true|false "] <!-- HTML attributes --> [accesskey="accessKey "] [dir="ltr|rtl"] [disabled="true|false "] [lang="lang "] [onblur="code "] [onchange="code "] [onclick="code "] [ondblclick="code "] [onfocus="code "] [onkeydown="code "] [onkeypress="code "] [onkeyup="code "] [onmousedown="code "] [onmousemove="code "] [onmouseout="code "] [onmouseover="code "] [onmouseup="code "] [onselect="code "] [readonly="true|false "] [style="style "] [styleClass="styleClass "] [tabindex="tabIndex "] [title="title "] > <f:selectItem> and/or <f:selectItems> action elements </h:selectOneMenu> Attributes
Example<h:form> <h:selectOneMenu value="#{user.country}"> <f:selectItems value="#{allCountries}" /> </h:selectOneMenu> </h:form>
This action represents an instance of the component type registered with the type ID javax.faces.HtmlSelectOneRadio (by default, an instance of the javax.faces.component.html.HtmlSelectOneRadio class), combined with a renderer registered with the renderer type ID javax.faces.Radio. The component is rendered as an HTML <table> element with an <input> element for each choice represented by its children (one or more UISelectItem and UISelectItems components) as the table cells. If the layout attribute is set to pageDirection, each cell is rendered in a separate table row; otherwise all cells are rendered in one row. A UISelectItemGroup child component is rendered as a nested table within the corresponding outer table cell. If the id attribute is set, a <span> element with an id attribute containing the component's client ID is rendered around the outer table. The <input> elements are rendered with a type attribute set to radio and a name attribute set to the component's client ID. Each <input> element is also nested within a <label> elements with a for attribute set to the component's client ID. For all choices that match one of the component's values, the checked attribute is set for the corresponding <input> element. Syntax<h:selectOneRadio [id="id "] [binding="componentBinding "] [rendered="true |false"] [value="value "] [converter="converter "] [required="true|false "] [validator="validatorMethod "] [valueChangeListener="listenerMethod "] [immediate="true|false "] [disabledClass="styleClass "] [enabledClass="styleClass "] [layout="lineDirection |pageDirection"] <!-- HTML attributes --> [accesskey="accessKey "] [border="border "] [dir="ltr|rtl"] [disabled="true|false "] [lang="lang "] [onblur="code "] [onchange="code "] [onclick="code "] [ondblclick="code "] [onfocus="code "] [onkeydown="code "] [onkeypress="code "] [onkeyup="code "] [onmousedown="code "] [onmousemove="code "] [onmouseout="code "] [onmouseover="code "] [onmouseup="code "] [onselect="code "] [readonly="true|false "] [style="style "] [styleClass="styleClass "] [tabindex="tabIndex "] [title="title "] > <f:selectItem> and/or <f:selectItems> action elements </h:selectOneRadio> Attributes
Example<h:form> <h:selectOneRadio value="#{user.country}"> <f:selectItems value="#{allCountries}" /> </h:selectOneRadio> </h:form> |
< Day Day Up > |