B.1. JSF Core Tags The JSF core tags provide access to all of the JSF features that do not directly relate to HTML rendering. Many of the HTML tags rely on core tags to specify optional features, such as validation functionality. To use the JSF core tags in a JSP file, you must include the following statement in the file header: <%@ taglib uri="http://java.sun.com/jsf/core" prefix="f" %> Use of f as the tag namespace prefix is both conventional and highly recommended but not required. B.1.1. <f:actionListener> Adds an action listener implementation to the surrounding UIComponent tag, such as an <h:commandLink>. The tag must specify the fully qualified class name of a class implementing the javax.faces.event.ActionListener interface. If you wish to handle action events via a method on a backing bean, use the appropriate attribute on the UI component tag instead. Table B-1. Attribute for <f:actionListener>Attribution | Description |
---|
type | The fully qualified class name of a class that implements the ActionListener interface |
B.1.2. <f:attribute> Adds an attribute to the surrounding tag. Using this tag is functionally equivalent to setting the attribute value in the parent tag. Values set on the parent component supersede any attributes set using this tag. Table B-2. Attributes for <f:attribute>Attribute | Description |
---|
name | The name of the attribute to set | value | The value of the attribute to set |
B.1.3. <f:convertDateTime> Converts the value contained by the surrounding component (such as an <h:outputText> tag) into a formatted date and time value. Table B-3. Attributes for <f:convertDateTime>Attribute | Description |
---|
dateStyle | Date format, as defined by java.text.DateFormat. Valid values are default, short, medium, long, and full. | locale | Locale to use for date formatting and parsing. | pattern | Custom formatting pattern for this converter. Supersedes dateStyle, type, and timeStyle. | timeStyle | Time format, as defined by java.text.DateFormat. Valid values are default, short, medium, long, and full. | timeZone | String or TimeZone object used to interpret time zone information when parsing time values. | type | String value, either date, time, or both. Default is date. |
B.1.4. <f:convertNumber> Converts the value contained by the surrounding component (such as an <h:outputText> tag) into a formatted numerical value. Table B-4. Attributes for <f:convertNumber>Attribute | Description |
---|
currencyCode | String specifying the ISO-4217 currency code used for currency formatting. | currencySymbol | Currency symbol. | groupingUsed | Boolean value specifying whether grouping separators (such as commas in U.S. formatted numbers) will be used. | integerOnly | Boolean value specifying whether only the integer component of the input/output will be included. | locale | String or Locale object specifying the number styles to be used in this conversion. | maxFractionDigits | Integer value specifying the maximum number of digits to include in the fractional component of the output. | maxIntegerDigits | Integer value specifying the maximum number of digits to include in the integer component of the output. | minFractionDigits | Integer value specifying the minimum number of digits to include in the fractional component of the output. | minIntegerDigits | Integer value specifying the minimum number of digits to include in the integer component of the output. | type | Specifies parsing as a number, currency, or percentage. The default is number. |
B.1.5. <f:converter> Adds a converter to a UI component, based on the converter ID specified in the faces-config.xml file. While class names are often used as converter IDs, this tag does not tag a class name. Table B-5. Attributes for <f:converter>Attribute | Description |
---|
converterId | A converter ID specified in the JSF configuration file for the application |
B.1.6. <f:facet> Defines a facet for a component. Facets are used by various components, such as <h:dataTable>, to override particular display attributes. Each facet tag contains a set of additional tags that will be used instead of or in addition to the regular tag body in particular circumstances. For example, the <h:dataTable> tag supports facets named header and footer that are used to render a header and a footer before and after iterating over a collection. Table B-6. Attributes for <f:facet>Attribute | Description |
---|
name | The name of this facet. Valid facet names depend on the component containing the facet. |
B.1.7. <f:loadBundle> Loads a resource bundle from the classpath and binds it to a variable. Once bound, the resource bundle can be accessed via the JSF expression language using the normal map syntax. Table B-7. Attributes for <f:loadBundle>Attribute | Description |
---|
basename | The fully qualified name of the resource bundle | var | The variable to bind this resource bundle to |
B.1.8. <f:param> Associates a parameter with a component. The meaning of the parameter depends on the component it is associated with. For example, parameters passed to the <h:outputFormat> tag are used to provide substitution values within a string. The binding and id attributes are rarely used. Table B-8. Attributes for <f:param>Attribute | Description |
---|
name | The name of this parameter. This attribute is optional. | value | The value of the parameter. This may be a JSF EL expression. | binding | Property expression indicating the bean to which this component is bound. Not normally used with this tag. | id | Overrides the ID of this component. |
B.1.9. <f:selectItem> Describes an item for use within a multiselection component, such as an <h:selectManyCheckbox>. Table B-9. Attributes for <f:selectItem>Attribute | Description |
---|
itemDescription | Description of the item, intended primarily for development tool use | itemDisabled | Boolean expression indicating whether this item is disabled | itemLabel | Textual label for the item | itemValue | Value that will be passed back to the server as a request parameter for this item | value | JSF EL expression evaluating to a SelectItem object containing the information for this item |
B.1.10. <f:selectItems> Adds a set of javax.faces.model.SelectItem objects, as indicated by the value binding or value, to the parent component. Table B-10. Attributes for <f:selectItems>Attribute | Description |
---|
binding | Property expression indicating the bean to which this component is bound. Not normally used with this tag. | id | Overrides the component identifier for this component. | value | JSF EL expression pointing to a List or array of SelectItem objects. |
B.1.11. <f:subview> A container tag for JSF components within a separate JSP page included within a JSF view (via <jsp:include> or similar mechanisms). Table B-11. Attributes for <f:subview>Attribute | Description |
---|
binding | Property expression indicating the bean to which this component is bound. Not normally used with this tag. | id | Overrides the ID of this component. | rendered | True or false, indicating whether or not this subview should be rendered. This may be a JSF EL expression that evaluates to a Boolean. |
B.1.12. <f:validator> Adds a validator to the parent UI input component, based on the validator ID specified in the faces-config.xml file. While class names are often used as validator IDs, this tag does not tag a class name. Validators must be specified within the tag for the input component that they are responsible for validating. Table B-12. Attribute for <f:validator>Attribute | Description |
---|
validatorId | A validator ID specified in the JSF configuration file for the application |
B.1.13. <f:validateDoubleRange> Adds a double range validator to the parent UI input component. With this tag in place, the parent component will accept values only within the boundaries specified by the tag. Both attributes are optional, although omitting both is silly. Table B-13. Attributes for <f:validateDoubleRange>Attribute | Description |
---|
maximum | The maximum value the field will accept (optional) | minimum | The minimum value the field will accept (optional) |
B.1.14. <f:validateLength> Adds a length validator to the parent UI input component. With this tag in place, the parent component will accept only input that meets the minimum and maximum length constraints specified. You may specify a minimum length, a maximum length, or both. Table B-14. Attributes for <f:validateLength>Attribute | Description |
---|
maximum | The maximum allowable length for the associated field (optional) | minimum | The minimum allowable length for the associated field (optional) |
B.1.15. <f:validateLongRange> Adds a long range validator to the parent UI input component. With this tag in place, the parent component will accept only values within the boundaries specified by the tag. This tag may be used to validate integer types as well as longs. Table B-15. Attribute for <f:validateLongRange>Attribute | Description |
---|
maximum | The maximum value the field will accept (optional) | minimum | The minimum value the field will accept (optional) |
B.1.16. <f:valueChangeListener> Adds a value change listener implementation to the surrounding UIComponent tag, such as <h:inputText>. The tag must specify the fully qualified class name of a class implementing the javax.faces.event.ValueChangeListener interface. If you wish to handle action events via a method on a backing bean, use the appropriate attribute on the UI component tag instead. Table B-16. Attribute for <f:valueChangeListener>Attribute | Description |
---|
type | The fully qualified class name of a class that implements the ValueChangeListener interface |
B.1.17. <f:view> This tag provides the root element for a JSF view. This tag must be present on every JSF JSP, and user interface component tags must be included within this tag. Table B-17. Attributes for <f:view>Attribute | Description |
---|
locale | Overrides the locale for this view |
B.1.18. <f:verbatim> Embeds markup in a JSF page. Table B-18. Attribute for <f:verbatim>Attribute | Description |
---|
escape | Boolean value indicating whether to escape <, > and & characters, allowing output of readable HTML. Defaults to false. |
|