Faces Core


Standard Syntax:
     <%@ taglib prefix="f" uri="http://xmlns.jcp.org/jsf/core" %>

XML Syntax:
     <anyxmlelement xmlns:f="http://xmlns.jcp.org/jsf/core" />

The core JavaServer Faces custom actions that are independent of any particular RenderKit.

Tag Library Information
Display NameFaces Core
Version2.2
Short Namef
URIhttp://xmlns.jcp.org/jsf/core
 

Tag Summary
actionListener

Register an ActionListener instance on the UIComponent associated with the closest parent UIComponent custom action.

ajax

Register an AjaxBehavior instance on one or more UIComponents implementing the ClientBehaviorHolder interface. This tag may be nested witin a single component (enabling Ajax for a single component), or it may be "wrapped" around multiple components (enabling Ajax for many components).

The String value for ids specified for execute and render may be specified as a search expression as outlined in the JavaDocs for UIComponent.findComponent(). The implementation must resolve these ids as specified for UIComponent.findComponent(). For example, consider the following Facelets code.

  1. <h:form id="form_1">
  2.   <h:panelGrid id="panel_1" rows="2">
  3.     <!-- content irrelevant -->
  4.   </h:panelGrid>
  5. </h:form>
  6.  
  7. <h:form id="form_2">
  8.   <h:commandButton id="button">
  9.     <f:ajax render=":form1:panel_1 panel_2" />
  10.   </h:commandButton>
  11.   <h:panelGrid id="panel_2">
  12.     <!-- content irrelevant -->
  13.   </h:panelGrid>
  14. </h:form>

When the button is pressed, panel_1, in form_1 will be re-rendered, along with panel_2 in form_2.

attributeAdd an attribute to the UIComponent associated with the closest parent UIComponent custom action.
attributes

Add attributes to the UIComponent associated with the closest parent UIComponent custom action. For each Map.Entry in the Map<String, Object> referenced by the value attribute of this tag, take the following action. If parent.getAttributes().containsKey(entry.getKey()) returns true, take no action for this entry. Otherwise, if entry.getValue() is a ValueExpression call parent.setValueExpression(entry.getKey(), entry.getValue()). Otherwise, call parent.getAttributes.put(entry.getKey(), entry.getValue()).

passThroughAttribute

Add an attribute to the passThroughAttributes Map of the UIComponent associated with the closest parent UIComponent tag.

passThroughAttributes

Add attributes to the passThroughAttributes Map of the UIComponent associated with the closest parent UIComponent tag. For each Map.Entry in the Map<String, Object> referenced by the value attribute of this tag, take the following action. Call component.getPassThroughAttributes().put(entry.getKey(), entry.getValue()).

converterRegister a named Converter instance on the UIComponent associated with the closest parent UIComponent custom action.
convertDateTimeRegister a DateTimeConverter instance on the UIComponent associated with the closest parent UIComponent custom action.
convertNumberRegister a NumberConverter instance on the UIComponent associated with the closest parent UIComponent custom action.
event

Allow JSF page authors to install ComponentSystemEventListener instances on a component in a page.

facet

Register a named facet on the UIComponent associated with the closest parent UIComponent custom action.

loadBundleLoad a resource bundle localized for the Locale of the current view, and expose it as a java.util.Map in the request attributes of the current request under the key specified by the value of the "var" attribute of this tag. The Map must behave such that if a get() call is made for a key that does not exist in the Map, the literal string ???KEY??? is returned from the Map, where KEY is the key being looked up in the Map, instead of a MissingResourceException being thrown. If the ResourceBundle does not exist, a JspException must be thrown.
metadata

Declare the metadata facet for this view. This must be a child of the <f:view>. This tag must reside within the top level XHTML file for the given viewId, or in a template client, but not in a template. The implementation must insure that the direct child of the facet is a UIPanel, even if there is only one child of the facet. The implementation must set the id of the UIPanel to be the value of the UIViewRoot.METADATA_FACET_NAME symbolic constant.

The implementation must allow templating for this element according to the following pattern.

template client XHTML view, view01.xhtml

  1. <ui:composition template="template.xhtml">
  2.     <ui:define name="metadata">
  3.       <f:metadata>
  4.         <f:viewParam name="id"/>
  5.       </f:metadata>
  6.     </ui:define>
  7.     <ui:define name="content">
  8.         <h1>The big news stories of the day</h1>
  9.     </ui:define>
  10. </ui:composition>

Note line 4. The page author must ensure that the <f:metadata> element does not appear on a template or included page. It must reside on the root page that corresponds to the viewId.

The template page, template.xhtml

  1. <html xmlns="http://www.w3.org/1999/xhtml"
  2.       xmlns:ui="http://xmlns.jcp.org/jsf/facelets"
  3.       xmlns:f="http://xmlns.jcp.org/jsf/core"
  4.       xml:lang="en" lang="en">
  5.  
  6. <body>
  7. <f:view>
  8.    
  9.         <ui:insert name="metadata"/>
  10.    
  11.     <div id="container">
  12.         <ui:insert name="content"/>
  13.     </div>
  14. </f:view>
  15. </body>
  16. </html>

The page author is not required to use templating, but if they do, it must be done as shown above, (or with <ui:include> in a similar manner).

param

Add a child UIParameter component to the UIComponent associated with the closest parent UIComponent custom action.

phaseListenerRegister a PhaseListener instance on the UIViewRoot in which this tag is nested.
selectItemAdd a child UISelectItem component to the UIComponent associated with the closest parent UIComponent custom action.
selectItems

Add a child UISelectItems component to the UIComponent associated with the closest parent UIComponent custom action.

When iterating over the select items, toString() must be called on the string rendered attribute values.

Version 2 of the specification introduces several new attributes, described below. These are: var, itemValue, itemLabel, itemDescription, itemDisabled, and itemLabelEscaped.

setPropertyActionListener

Register an ActionListener instance on the UIComponent associated with the closest parent UIComponent custom action. This actionListener will cause the value given by the "value" attribute to be set into the ValueExpression given by the "target" attribute.

The implementation of this tag creates a special ActionListener instance and registers it on the ActionSource associated with our most immediate surrounding instance of a tag whose implementation class is a subclass of UIComponentTag. This tag creates no output to the page currently being created.

The ActionListener instance created and installed by this tag has the following behavior and contract.

  • Only create and register the ActionListener instance the first time the component for this tag is created
  • The "target" and "value" tag attributes are ValueExpression instances and are stored unevaluated as instance variables of the listener.
  • When the listener executes, perform the following:
      Call getValue() on the "value" ValueExpression.
      If value of the "value" expression is null, call setValue() on the "target" ValueExpression with the null value.
      If the value of the "value" expression is not null, call getType() on the "value" and "target" ValueExpressions to determine their property types.
      Coerce the value of the "value" expression to the "target" expression value type following the Expression Language coercion rules. Call setValue() on the "target" ValueExpression with the resulting value.
      If either coercion or the execution of setValue() fails throw an AbortProcessingException.
subview

Container action for all JavaServer Faces core and custom component actions used on a nested page via "jsp:include" or any custom action that dynamically includes another page from the same web application, such as JSTL's "c:import".

validateDoubleRangeRegister a DoubleRangeValidator instance on the UIComponent associated with the closest parent UIComponent custom action.
validateLengthRegister a LengthValidator instance on the UIComponent associated with the closest parent UIComponent custom action.
validateLongRangeRegister a LongRangeValidator instance on the UIComponent associated with the closest parent UIComponent custom action.
validateBean

A validator that delegates the validation of the local value to the Bean Validation API. The validationGroups attribute serves as a filter that instructs the Bean Validation API which contraints to enforce. If there are any constraint violations reported by Bean Validation, the value is considered invalid.

validateRegex

A validator that uses the pattern attribute to validate the wrapping component. The entire pattern is matched against the String value of the component. If it matches, it's valid.

validateRequired

A validator that enforces the presence of a value. It has the same affect as setting the required attribute on a UIInput to true.

validator

Register a named Validator instance on the UIComponent associated with the closest parent UIComponent custom action.

Usage outside of an EditableValueHolder parent

If this element is nested within a UIComponent tag that has other UIComponent children, the validator will be automatically added to all the child components as well as this one. The implementation must ensure this occurs even if the parent of this element is not an instance of EditableValueHolder.

valueChangeListenerRegister a ValueChangeListener instance on the UIComponent associated with the closest parent UIComponent custom action.
verbatim

The use of this element has been deprecated in Facelets for JSF 2.0 and beyond. Create and register a child UIOutput component associated with the closest parent UIComponent custom action, which renders nested body content.

view

Container for all JavaServer Faces core and custom component actions used on a page.

viewParam

Used inside of the metadata facet of a view, this tag causes a UIViewParameter to be attached as metadata for the current view. Because UIViewParameter extends UIInput all of the attributes and nested child content for any UIInput tags are valid on this tag as well.

viewAction

This action component specifies an application-specific command (or action), using an EL method expression, to be invoked during one of the JSF lifecycle phases, by default Invoke Application.

resetValues

Reset specific input values. Interpret the value of the render attribute as a space separated list of client identifiers suitable for passing directly to UIViewRoot.resetValues(). The implementation must cause an ActionListener to be attached to the ActionSource component in which this tag is nested that calls UIViewRoot.resetValues() passing the value of the render attribute as the argument.

 

Tag Library Validator
com.sun.faces.taglib.jsf_core.CoreValidatorThis tag library validator verifies certain semantic restrictions on the use of JavaServer Faces component actions, including the requirement that component tags nested inside a JSTL conditional tag must have a value specified for the "id" attribute.
 

Listeners
com.sun.faces.config.ConfigureListener