Monday, July 20, 2009

JSF Core Tags

These tags allows you to take advantages of features of JSF framework, like validation, conversion , event handling. Core library is stepchild of Html library. i.e. core library supports the html library. Core tag library also contains tags for views and sub-views , loading resource bundle, adding arbitrary text to a page. Some examples of JSF core tags are given bellow:
  • f: view tag is used to create top level view
  • f: subview tag is used to create subview of a view.
  • f: validator tag is used to add a validator to a component.
  • f: converter tag is used to add an arbitrary converter to a component.
  • f: actionListener tag is used to add an action listener to a component.
  • f:valueChangeListener tag is used to add a valuechange listener to a component
Some examples have been given below to understand how to use these tags:


f: view tag is used to create top level view and is a container for all JSF component tags on a page. Where locale attribute provides several options for presenting localized views of your application. Here "en" represents English and if we give velue "fr" to locale attribute then french view will be displayed. So this attribute is useful for internationalization purpose.


The Validator tag registers a Validator on the component associated with the enclosing tag. In validatorId field, we give the value of one of the validator-id element of a validator in your Faces configuration file.
In JSF Core Tag Library there are 18 core tags.
  • f :view Creates the top-level view
  • f:subview Creates a subview of a view
  • f:attribute Adds an attribute to a component
  • f:param Constructs a parameter component
  • f:converter Adds an arbitrary converter to a component
  • f:converterDateTime Adds a datetime converter to a component
  • f:converterNumber Adds a number converter to a component
  • f:actionListener Adds an action listener to a component
  • f:valueChangeListener Adds a valuechange listener to a component
  • f:validator adds a validator to a component
  • f:validateDoubleRange Validates a double range for a component’s value
  • f:validateLength Validates the length of a component’s value
  • f:validateLongRange Validates a long range for a component’s value
  • f:facet Adds a facet to a component
  • f:loadBundle Loads a resource bundle, stores properties as a Map
  • f:selectitems Specifies items for a select one or select many component
  • f:selectitem Specifies an item for a select one or select many component
  • f:verbatim Adds markup to a JSF page


1 comment: