Previous Section  < Day Day Up >  Next Section

A.2 HTML Tag Library Actions

The 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 Attributes

The 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.

Table A-2. Supported HTML 4.01 attributes

Attribute name

Java type

Description

accept
String

A comma-separated list of content types the server that processes the form handles correctly.

acceptcharset
String

Corresponds to the HTML accept-charset attribute (with a dash as a separator). A space- and/or comma-separated list of character encodings accepted by the server processing the form.

alt
String

Alternative text that may be used by a browser that can't show the element (e.g., text-to-speech browser).

bgcolor
String

Deprecated. The background color for the document body or table cells.

border
String

The number of pixels for the frame around a table.

cellpadding
String

The amount of space between cell borders and the cell content, in pixels or a percentage of the space available.

cellspacing
String

The amount of space between cells and the table frame, in pixels or a percentage of the space available.

charset
String

The character encoding of the target resource.

coords
String

A comma-separated list of values that specifies the position of the element on the screen.

dir
String

The text direction, one of ltr (left-to-right) or rtl (right-to-left).

disabled
boolean

If set to true, the element is disabled: it can't receive focus, it's skipped in tabbing navigation, and it can't be "successful" (e.g., a button can't submit a form).

enctype
String

The content type used for the form data in a POST request.

frame
String

One of void, above, below, hsides, lhs, rhs, vsides, box, or border. Specifies the visible sides of a table frame.

hreflang
String

Must be used together only with the href attribute. Specifies the language of the referenced resource.

lang
String

The base language.

longdesc
String

A description of an image.

onblur
String

Client-side event handler code to execute when the element loses focus. Only valid for the same elements as onfocus.

onchange
String

Client-side event handler code to execute when the element loses focus and its value has been changed since it got focus. Only valid for <input>, <select>, and <textarea>.

onclick
String

Client-side event handler code to execute when the element is clicked.

ondblclick
String

Client-side event handler code to execute when the element is double-clicked.

onfocus
String

Client-side event handler code to execute when the element gets focus. Only valid for <a>, <area>, <label>, <input>, <select>, <textarea>, and <button>.

onkeydown
String

Client-side event handler code to execute when a key is pressed down over the element.

onkeypress
String

Client-side event handler code to execute when a key is pressed and released over the element.

onkeyup
String

Client-side event handler code to execute when a key is released over the element.

onmousedown
String

Client-side event handler code to execute when a mouse button is pressed over the element.

onmousemove
String

Client-side event handler code to execute when the mouse is moved while over the element.

onmouseout
String

Client-side event handler code to execute when the mouse button is moved away from the element.

onmouseover
String

Client-side event handler code to execute when the mouse is moved onto the element.

onmouseup
String

Client-side event handler code to execute when a mouse button is released over the element.

onreset
String

Client-side event handler code to execute when a form is reset. Only valid for <form>.

onselect
String

Client-side event handler code to execute when text is selected. Only valid for <input> and <textarea>.

onsubmit
String

Client-side event handler code to execute when a form is submitted. Only valid for <form>.

readonly
boolean

If set to true, the element is read-only: it can't receive focus, it's skipped in tabbing navigation.

rel
String

A space-separated list of link types, describing the relationship from the current document and the referenced document.

rev
String

A space-separated list of link types, describing the reverse link for the referenced document.

rules
String

One of none, groups, rows, cols, or all. Specifies the visible rules between cells within a table.

shape
String

One of default, rect, circle, or poly. Specifies the shape of a region.

size
String

The width of an input field in number of characters or the number visible options in a selection list.

style
String

Explicit CSS style information. This attribute is rendered on the main element (e.g., <table>) representing the component or on a <span> element for a component that isn't represented by a main element.

styleClass
String

One or more space-separated class names that can be used in stylesheets. The HTML 4.01 attribute name for the same purpose is class, but unfortunately that name can't be used as a JSP custom action attribute name (because of a name clash with the class property implemented by the Object class). The class attribute is rendered on the same type of element as the style attribute.

summary
String

A summary of a table's purpose.

tabindex
String

The element's position in the tabbing ordering, a number between 0 and 32767.

target
String

The name of the frame that should display the response resulting from the request triggered by the element.

title
String

An advisory title for the element, e.g., used as a tool-tip.

type
String

When used for an <a> element, an advisory hint about the content type of the referenced resource.

width
String

The desired width of a table, in pixels or a percentage of the space available.

<h:column>

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

Attribute name

Java type

EL expression type

Description

binding
String

VB

Must be a value binding expression for a property the component is bound to.

id
String

None

The component ID.

rendered
boolean

Any

If set to false, the component isn't rendered and doesn't participate in any request processing.

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>
<h:commandButton>

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

Attribute name

Java type

EL expression type

Description

action
String

MB

A method binding for a method with a String return type and an empty parameter list. Invoked to process the component's ActionEvent.

actionListener
String

MB

A method binding for a method with a void return type and an ActionEvent parameter. Invoked to process the component's ActionEvent.

binding
String

VB

Must be a value binding expression for a property the component is bound to.

id
String

None

The component ID.

image
String

Any

An absolute or relative URL for an image. If set, the type attribute for the <input> element is set to image.

immediate
boolean

Any

If set to true, the ActionEvent is processed in the Apply Request Values phase; if false, the event is processed in the Invoke Application phase.

rendered
boolean

Any

If set to false, the component isn't rendered and doesn't participate in any request processing.

type
String

Any

The button type, one of submit or reset. Ignored if image is set.

value
Object

Any

The component value.

Example

<h:form>

  <h:commandButton value="Save" action="#{formHandler.save}" />

</h:form>
<h:commandLink>

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

Attribute name

Java type

EL expression type

Description

action
String

MB

A method binding for a method with a String return type and an empty parameter list. Invoked to process the component's ActionEvent.

actionListener
String

MB

A method binding for a method with a void return type and an ActionEvent parameter. Invoked to process the component's ActionEvent.

binding
String

VB

Must be a value binding expression for a property the component is bound to.

id
String

None

The component ID.

immediate
boolean

Any

If set to true, the ActionEvent is processed in the Apply Request Values phase; if false, the event is processed in the Invoke Application phase.

rendered
boolean

Any

If set to false, the component isn't rendered and doesn't participate in any request processing.

value
Object

Any

The component value.

Example

<h:form>

  <h:commandLink action="#{formHandler.save}">

    <hLoutputText value="Save" />

  </h:commandLink>

</h:form>
<h:dataTable>

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

Attribute name

Java type

EL expression type

Description

binding
String

VB

Must be a value binding expression for a property the component is bound to.

columnClasses
String

Any

A comma-separated list of CSS class names for the table body <td> elements. If there are fewer classes than columns, no class attribute is rendered for the last columns. If there are more classes than columns, the overflow classes are ignored.

first
int

Any

The zero-based index of the first row in the model to process.

footerClass
String

Any

The CSS class for footer cells.

headerClass
String

Any

The CSS class for header cells.

id
String

None

The component ID.

rendered
boolean

Any

If set to false, the component isn't rendered and doesn't participate in any request processing.

rowClasses
String

Any

A comma-separated list of CSS class names for the table rows. The classes are used for the <tr> elements in the order they are listed, repeating the list over all rows in the table.

rows
int

Any

The number of rows to process.

value
Object

VB

The component value.

var
String

No

The name of the request scope variable that holds the current row object.

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>
<h:form>

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

Attribute name

Java type

EL expression type

Description

binding
String

VB

Must be a value binding expression for a property the component is bound to.

id
String

None

The component ID.

rendered
boolean

Any

If set to false, the component isn't rendered and doesn't participate in any request processing.

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>
<h:graphicImage>

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

Attribute name

Java type

EL expression type

Description

binding
String

VB

Must be a value binding expression for a property the component is bound to.

id
String

None

The component ID.

rendered
boolean

Any

If set to false, the component isn't rendered and doesn't participate in any request processing.

url
String

Any

The image resource URL. An alias for the value attribute.

value
Object

Any

The component value.

Example

<h:graphicImage value="/images/folder-open.gif" />
<h:inputHidden>

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

Attribute name

Java type

EL expression type

Description

binding
String

VB

Must be a value binding expression for a property the component is bound to.

converter
String or javax.faces.convert.Converter

VB

If set as a static value, a registered converter ID. If set as a value binding expression, an instance of an object that implements Converter.

id
String

None

The component ID.

immediate
boolean

Any

If set to true, the ValueChangeEvent is processed in the Apply Request Values phase; if false, the event is processed in the Process Validations phase.

rendered
boolean

Any

If set to false, the component isn't rendered and doesn't participate in any request processing.

required
boolean

Any

If true, JSF verifies that a value is submitted for this component and marks it as invalid and queues an error message if not.

validator
String

MB

A method binding for a method with a void return type and FacesContext, UIComponent, and Object parameters. Invoked to validate the component's local value (the Object parameter).

value
Object

VB

The component value.

valueChangeListener
String

MB

A method binding for a method with a void return type and an ValueChangeEvent parameter. Invoked to process the component's ValueChangeEvent.

Example

<h:form>

  <h:inputHidden value="#{user.type}" />

</h:form>
<h:inputSecret>

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

Attribute name

Java type

EL expression type

Description

binding
String

VB

Must be a value binding expression for a property the component is bound to.

converter
String or javax.faces.convert.Converter

VB

If set as a static value, a registered converter ID. If set as a value binding expression, an instance of an object that implements Converter.

id
String

None

The component ID.

immediate
boolean

Any

If set to true, the ValueChangeEvent is processed in the Apply Request Values phase; if false, the event is processed in the Process Validations phase.

redisplay
boolean

Any

If set to true, render the component's value as the <input> element value attribute value.

rendered
boolean

Any

If set to false, the component isn't rendered and doesn't participate in any request processing.

required
boolean

Any

If true, JSF verifies that a value is submitted for this component and marks it as invalid and queues an error message if not.

validator
String

MB

A method binding for a method with a void return type and FacesContext, UIComponent, and Object parameters. Invoked to validate the component's local value (the Object parameter).

value
Object

VB

The component value.

valueChangeListener
String

MB

A method binding for a method with a void return type and an ValueChangeEvent parameter. Invoked to process the component's ValueChangeEvent.

Example

<h:form>

  <h:inputSecret value="#{user.password}" />

</h:form>
<h:inputText>

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

Attribute name

Java type

EL expression type

Description

binding
String

VB

Must be a value binding expression for a property the component is bound to.

converter
String or javax.faces.convert.Converter

VB

If set as a static value, a registered converter ID. If set as a value binding expression, an instance of an object that implements Converter.

id
String

None

The component ID.

immediate
boolean

Any

If set to true, the ValueChangeEvent is processed in the Apply Request Values phase; if false, the event is processed in the Process Validations phase.

rendered
boolean

Any

If set to false, the component isn't rendered and doesn't participate in any request processing.

required
boolean

Any

If true, JSF verifies that a value is submitted for this component and marks it as invalid and queues an error message if not.

validator
String

MB

A method binding for a method with a void return type and FacesContext, UIComponent, and Object parameters. Invoked to validate the component's local value (the Object parameter).

value
Object

VB

The component value.

valueChangeListener
String

MB

A method binding for a method with a void return type and an ValueChangeEvent parameter. Invoked to process the component's ValueChangeEvent.

Example

<h:form>

  <h:inputText value="#{user.email}" />

</h:form>
<h:inputTextarea>

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

Attribute name

Java type

EL expression type

Description

binding
String

VB

Must be a value binding expression for a property the component is bound to.

converter
String or javax.faces.convert.Converter

VB

If set as a static value, a registered converter ID. If set as a value binding expression, an instance of an object that implements Converter.

id
String

None

The component ID.

immediate
boolean

Any

If set to true, the ValueChangeEvent is processed in the Apply Request Values phase; if false, the event is processed in the Process Validations phase.

rendered
boolean

Any

If set to false, the component isn't rendered and doesn't participate in any request processing.

required
boolean

Any

If true, JSF verifies that a value is submitted for this component and marks it as invalid and queues an error message if not.

validator
String

MB

A method binding for a method with a void return type and FacesContext, UIComponent, and Object parameters. Invoked to validate the component's local value (the Object parameter).

value
Object

VB

The component value.

valueChangeListener
String

MB

A method binding for a method with a void return type and an ValueChangeEvent parameter. Invoked to process the component's ValueChangeEvent.

Example

<h:form>

  <h:inputTextarea value="#{user.bio}" />

</h:form>
<h:message>

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

Attribute name

Java type

EL expression type

Description

binding
String

VB

Must be a value binding expression for a property the component is bound to.

errorClass
String

Any

One or more space-separated CSS class names used as a <span> element's class attribute if the message is of ERROR severity.

errorStyle
String

Any

Explicit CSS style information used as a <span> element's style attribute if the message is of ERROR severity.

fatalClass
String

Any

One or more space-separated CSS class names used as a <span> element's class attribute if the message is of FATAL severity.

fatalStyle
String

Any

Explicit CSS style information used as a <span> element's style attribute if the message is of FATAL severity.

for
String

Any

A string for locating the component for which the message is rendered in the same format as for the UIComponent findComponent() method (see Appendix C for details).

id
String

None

The component ID.

infoClass
String

Any

One or more space-separated CSS class names used as a <span> element's class attribute if the message is of INFO severity.

infoStyle
String

Any

Explicit CSS style information used as a <span> element's style attribute if the message is of INFO severity.

rendered
boolean

Any

If set to false, the component isn't rendered and doesn't participate in any request processing.

showDetail
boolean

Any

If true, renders the message details text.

showSummary
boolean

Any

If true, renders the message summary text.

tooltip
boolean

Any

If true, renders the message summary as the value of a <span> element's title attribute.

warnClass
String

Any

One or more space-separated CSS class names used as a <span> element's class attribute if the message is of WARN severity.

warnStyle
String

Any

Explicit CSS style information used as a <span> element's style attribute if the message is of WARN severity.

Example

<h:form>

  <h:inputText id="firstName" value="#{user.firstName}" />

  <h:message for="firstName" errorStyle="color: red" />

</h:form>
<h:messages>

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

Attribute name

Java type

EL expression type

Description

binding
String

VB

Must be a value binding expression for a property the component is bound to.

errorClass
String

Any

One or more space-separated CSS class names used as a <span> element's class attribute if the message is of ERROR severity.

errorStyle
String

Any

Explicit CSS style information used as a <span> element's style attribute if the message is of ERROR severity.

fatalClass
String

Any

One or more space-separated CSS class names used as a <span> element's class attribute if the message is of FATAL severity.

fatalStyle
String

Any

Explicit CSS style information used as a <span> element's style attribute if the message is of FATAL severity.

globalOnly
boolean

Any

If true, render only messages without a component ID.

id
String

None

The component ID.

infoClass
String

Any

One or more space-separated CSS class names used as a <span> element's class attribute if the message is of INFO severity.

infoStyle
String

Any

Explicit CSS style information used as a <span> element's style attribute if the message is of INFO severity.

layout
String

Any

One of list or table. If set to table, render the messages as an HTML table with one row per message.

rendered
boolean

Any

If set to false, the component isn't rendered and doesn't participate in any request processing.

showDetail
boolean

Any

If true, render the message details text.

showSummary
boolean

Any

If true, render the message summary text.

tooltip
boolean

Any

If true, render the message summary as the value of a <span> element's title attribute.

warnClass
String

Any

One or more space-separated CSS class names used as a <span> element's class attribute if the message is of WARN severity.

warnStyle
String

Any

Explicit CSS style information used as a <span> element's style attribute if the message is of WARN severity.

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>
<h:outputFormat>

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

Attribute name

Java type

EL expression type

Description

binding
String

VB

Must be a value binding expression for a property the component is bound to.

converter
String or javax.faces.convert.Converter

VB

If set as a static value, a registered converter ID. If set as a value binding expression, an instance of an object that implements Converter.

escape
boolean

Any

If true, render special HTML and XML characters as character entity codes, e.g., < as &lt;.

id
String

None

The component ID.

rendered
boolean

Any

If set to false, the component isn't rendered and doesn't participate in any request processing.

value
Object

No

The component value.

Example

<f:loadBundle basename="messages" var="msgs" />

<h:outputFormat value="#{msgs.sunRiseAndSetText}">

  <f:param value="#{city.sunRiseTime}" />

  <f:param value="#{city.sunSetTime}" />

</h:outputFormat>
<h:outputLabel>

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.

With the JSF 1.0 reference implementation, the action element that represents the component identified by the for attribute value must appear before the <h:outputLabel> element in the JSP page or both action elements must be nested within an action element for a component that renders its children, e.g., <h:panelGrid> or <h:panelGroup>. This is because the label renderer requires that the referenced component exists when the output component is rendered. The specification is not clear enough to tell if this is a bug or not, so other implementations may be less restrictive about the ordering and nesting.


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

Attribute name

Java type

EL expression type

Description

binding
String

VB

Must be a value binding expression for a property the component is bound to.

converter
String or javax.faces.convert.Converter

VB

If set as a static value, a registered converter ID. If set as a value binding expression, an instance of an object that implements Converter.

for
String

Any

A string for locating the component for which the message is rendered in the same format as for the UIComponent findComponent() method (see Appendix B for details).

id
String

None

The component ID.

rendered
boolean

Any

If set to false, the component isn't rendered and doesn't participate in any request processing.

value
Object

No

The component value.

Note that the JSF 1.0 reference implementation ignores the value.

Example

<h:inputText id="firstName" value="#{user.firstName}" />

<h:outputLabel for="firstName" />
<h:outputLink>

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

Attribute name

Java type

EL expression type

Description

binding
String

VB

Must be a value binding expression for a property the component is bound to.

converter
String or javax.faces.convert.Converter

VB

If set as a static value, a registered converter ID. If set as a value binding expression, an instance of an object that implements Converter.

id
String

None

The component ID.

rendered
boolean

Any

If set to false, the component isn't rendered and doesn't participate in any request processing.

value
Object

No

The component value.

Example

<h:outputLink value="../../logout.jsp" />
<h:outputText>

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

Attribute name

Java type

EL expression type

Description

binding
String

VB

Must be a value binding expression for a property the component is bound to.

converter
String or javax.faces.convert.Converter

VB

If set as a static value, a registered converter ID. If set as a value binding expression, an instance of an object that implements Converter.

escape
boolean

Any

If true, render special HTML and XML characters as character entity codes, e.g., < as &lt;.

id
String

None

The component ID.

rendered
boolean

Any

If set to false, the component isn't rendered and doesn't participate in any request processing.

value
Object

No

The component value.

Example

<h:outputText value="#{user.name}" />
<h:panelGrid>

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

Attribute name

Java type

EL expression type

Description

binding
String

VB

Must be a value binding expression for a property the component is bound to.

columnClasses
String

Any

A comma-separated list of CSS class names for the table body <td> elements. If there are fewer classes than columns, no class attribute is rendered for the last columns. If there are more classes than columns, the overflow classes are ignored.

columns
int

Any

The number of columns to render.

footerClass
String

Any

The CSS class for footer cells.

headerClass
String

Any

The CSS class for header cells.

id
String

None

The component ID.

rendered
boolean

Any

If set to false, the component isn't rendered and doesn't participate in any request processing.

rowClasses
String

Any

A comma-separated list of CSS class names for the table rows. The classes are used for the <tr> elements in the order they are listed, repeating the list over all rows in the table.

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>
<h:panelGroup>

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

Attribute name

Java type

EL expression type

Description

binding
String

VB

Must be a value binding expression for a property the component is bound to.

id
String

None

The component ID.

rendered
boolean

Any

If set to false, the component isn't rendered and doesn't participate in any request processing.

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>
<h:selectBooleanCheckbox>

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

Attribute name

Java type

EL expression type

Description

binding
String

VB

Must be a value binding expression for a property the component is bound to.

converter
String or javax.faces.convert.Converter

VB

If set as a static value, a registered converter ID. If set as a value binding expression, an instance of an object that implements Converter.

id
String

None

The component ID.

immediate
boolean

Any

If set to true, the ValueChangeEvent is processed in the Apply Request Values phase; if false, the event is processed in the Process Validations phase.

rendered
boolean

Any

If set to false, the component isn't rendered and doesn't participate in any request processing.

required
boolean

Any

If true, JSF verifies that a value is submitted for this component and marks it as invalid and queues an error message if not.

validator
String

MB

A method binding for a method with a void return type and FacesContext, UIComponent and Object parameters. Invoked to validate the component's local value (the Object parameter).

value
Object

VB

The component value.

valueChangeListener
String

MB

A method binding for a method with a void return type and an ValueChangeEvent parameter. Invoked to process the component's ValueChangeEvent.

Example

<h:form>

  <h:selectBooleanCheckbox value="#{user.vip}" />

</h:form>
<h:selectManyCheckbox>

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

Attribute name

Java type

EL expression type

Description

binding
String

VB

Must be a value binding expression for a property the component is bound to.

converter
String or javax.faces.convert.Converter

VB

If set as a static value, a registered converter ID. If set as a value binding expression, an instance of an object that implements Converter.

disabledClass
String

Any

The CSS class used for the <label> element around disabled choices.

enabledClass
String

Any

The CSS class used for the <label> element around enabled choices.

id
String

None

The component ID.

immediate
boolean

Any

If set to true, the ValueChangeEvent is processed in the Apply Request Values phase; if false, the event is processed in the Process Validations phase.

layout
String

Any

If set to lineDirection, the checkboxes are rendered horizontally. If set to pageDirection, the checkboxes are rendered vertically.

rendered
boolean

Any

If set to false, the component isn't rendered and doesn't participate in any request processing.

required
boolean

Any

If true, JSF verifies that a value is submitted for this component and marks it as invalid and queues an error message if not.

validator
String

MB

A method binding for a method with a void return type and FacesContext, UIComponent and Object parameters. Invoked to validate the component's local value (the Object parameter).

value
Object

VB

The component value.

valueChangeListener
String

MB

A method binding for a method with a void return type and an ValueChangeEvent parameter. Invoked to process the component's ValueChangeEvent.

Example

<h:form>

  <h:selectManyCheckbox value="#{user.projects}">

    <f:selectItems value="#{allProjects}" />

  </h:selectManyCheckbox>

</h:form>
<h:selectManyListbox>

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

Attribute name

Java type

EL expression type

Description

binding
String

VB

Must be a value binding expression for a property the component is bound to.

converter
String or javax.faces.convert.Converter

VB

If set as a static value, a registered converter ID. If set as a value binding expression, an instance of an object that implements Converter.

id
String

None

The component ID.

immediate
boolean

Any

If set to true, the ValueChangeEvent is processed in the Apply Request Values phase; if false, the event is processed in the Process Validations phase.

rendered
boolean

Any

If set to false, the component isn't rendered and doesn't participate in any request processing.

required
boolean

Any

If true, JSF verifies that a value is submitted for this component and marks it as invalid and queues an error message if not.

validator
String

MB

A method binding for a method with a void return type and FacesContext, UIComponent and Object parameters. Invoked to validate the component's local value (the Object parameter).

value
Object

VB

The component value.

valueChangeListener
String

MB

A method binding for a method with a void return type and an ValueChangeEvent parameter. Invoked to process the component's ValueChangeEvent.

Example

<h:form>

  <h:selectManyListbox value="#{user.projects}">

    <f:selectItems value="#{allProjects}" />

  </h:selectManyListbox>

</h:form>
<h:selectManyMenu>

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

Attribute name

Java type

EL expression type

Description

binding
String

VB

Must be a value binding expression for a property the component is bound to.

converter
String or javax.faces.convert.Converter

VB

If set as a static value, a registered converter ID. If set as a value binding expression, an instance of an object that implements Converter.

id
String

None

The component ID.

immediate
boolean

Any

If set to true, the ValueChangeEvent is processed in the Apply Request Values phase; if false, the event is processed in the Process Validations phase.

rendered
boolean

Any

If set to false, the component isn't rendered and doesn't participate in any request processing.

required
boolean

Any

If true, JSF verifies that a value is submitted for this component and marks it as invalid and queues an error message if not.

validator
String

MB

A method binding for a method with a void return type and FacesContext, UIComponent and Object parameters. Invoked to validate the component's local value (the Object parameter).

value
Object

VB

The component value.

valueChangeListener
String

MB

A method binding for a method with a void return type and an ValueChangeEvent parameter. Invoked to process the component's ValueChangeEvent.

Example

<h:form>

  <h:selectManyMenu value="#{user.projects}">

    <f:selectItems value="#{allProjects}" />

  </h:selectManyMenu>

</h:form>
<h:selectOneListbox>

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

Attribute name

Java type

EL expression type

Description

binding
String

VB

Must be a value binding expression for a property the component is bound to.

converter
String or javax.faces.convert.Converter

VB

If set as a static value, a registered converter ID. If set as a value binding expression, an instance of an object that implements Converter.

id
String

None

The component ID.

immediate
boolean

Any

If set to true, the ValueChangeEvent is processed in the Apply Request Values phase; if false, the event is processed in the Process Validations phase.

rendered
boolean

Any

If set to false, the component isn't rendered and doesn't participate in any request processing.

required
boolean

Any

If true, JSF verifies that a value is submitted for this component and marks it as invalid and queues an error message if not.

validator
String

MB

A method binding for a method with a void return type and FacesContext, UIComponent and Object parameters. Invoked to validate the component's local value (the Object parameter).

value
Object

VB

The component value.

valueChangeListener
String

MB

A method binding for a method with a void return type and an ValueChangeEvent parameter. Invoked to process the component's ValueChangeEvent.

Example

<h:form>

  <h:selectOneListbox value="#{user.country}">

    <f:selectItems value="#{allCountries}" />

  </h:selectOneListbox>

</h:form>
<h:selectOneMenu>

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

Attribute name

Java type

EL expression type

Description

binding
String

VB

Must be a value binding expression for a property the component is bound to.

converter
String or javax.faces.convert.Converter

VB

If set as a static value, a registered converter ID. If set as a value binding expression, an instance of an object that implements Converter.

id
String

None

The component ID.

immediate
boolean

Any

If set to true, the ValueChangeEvent is processed in the Apply Request Values phase; if false, the event is processed in the Process Validations phase.

rendered
boolean

Any

If set to false, the component isn't rendered and doesn't participate in any request processing.

required
boolean

Any

If true, JSF verifies that a value is submitted for this component and marks it as invalid and queues an error message if not.

validator
String

MB

A method binding for a method with a void return type and FacesContext, UIComponent and Object parameters. Invoked to validate the component's local value (the Object parameter).

value
Object

VB

The component value.

valueChangeListener
String

MB

A method binding for a method with a void return type and an ValueChangeEvent parameter. Invoked to process the component's ValueChangeEvent.

Example

<h:form>

  <h:selectOneMenu value="#{user.country}">

    <f:selectItems value="#{allCountries}" />

  </h:selectOneMenu>

</h:form>
<h:selectOneRadio>

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

Attribute name

Java type

EL expression type

Description

binding
String

VB

Must be a value binding expression for a property the component is bound to.

converter
String or javax.faces.convert.Converter

VB

If set as a static value, a registered converter ID. If set as a value binding expression, an instance of an object that implements Converter.

disabledClass
String

Any

The CSS class used for the <label> element around disabled choices.

enabledClass
String

Any

The CSS class used for the <label> element around enabled choices.

id
String

None

The component ID.

immediate
boolean

Any

If set to true, the ValueChangeEvent is processed in the Apply Request Values phase; if false, the event is processed in the Process Validations phase.

layout
String

Any

If set to lineDirection, the checkboxes are rendered horizontally. If set to pageDirection, the checkboxes are rendered vertically.

rendered
boolean

Any

If set to false, the component isn't rendered and doesn't participate in any request processing.

required
boolean

Any

If true, JSF verifies that a value is submitted for this component and marks it as invalid and queues an error message if not.

validator
String

MB

A method binding for a method with a void return type and FacesContext, UIComponent and Object parameters. Invoked to validate the component's local value (the Object parameter).

value
Object

VB

The component value.

valueChangeListener
String

MB

A method binding for a method with a void return type and an ValueChangeEvent parameter. Invoked to process the component's ValueChangeEvent.

Example

<h:form>

  <h:selectOneRadio value="#{user.country}">

    <f:selectItems value="#{allCountries}" />

  </h:selectOneRadio>

</h:form>
    Previous Section  < Day Day Up >  Next Section