JBoss.orgCommunity Documentation

Chapter 16. Functions

16.1. r:clientId
16.2. r:component
16.3. r:element
16.4. r:jQuery
16.5. r:findComponent
16.6. r:isUserInRole

Read this chapter for details on special functions for use with particular components. Using JavaServer Faces Expression Language ( JSF EL), these functions can be accessed through the data attribute of components. Refer to Section 2.4.4.1, “data” for details on the data attribute.

The r:clientId('id') function returns the client identifier related to the passed component identifier ('id'). If the specified component identifier is not found, null is returned instead.

The r:component('id') function is equivalent to the RichFaces.$('clientId') code. It returns the client object instance based on the passed server-side component identifier ( 'id'). If the specified component identifier is not found, null is returned instead. The function can be used to get an object from a component to call a JavaScript API function without using the <r:componentControl> component.

The r:element('id') function is a shortcut for the equivalent document.getElementById(#{r:clientId('id')}) code. It returns the element from the client, based on the passed server-side component identifier. If the specified component identifier is not found, null is returned instead.

The r:jQuery('id') function is a shortcut for the equivalent jQuery('##{r:clientId('id')}) code. It returns the jQuery object for the element located by the passed server-side component identifier. If the specified component identifier is not found, null is returned instead.

The r:findComponent('id') function returns the a UIComponent instance of the passed component identifier. If the specified component identifier is not found, null is returned instead.


The r:isUserInRole(Object) function checks whether the logged-in user belongs to a certain user role, such as being an administrator. User roles are defined in the web.xml settings file.