Tomahawk sandbox tag library.
Tag globalId

A simple container-component that causes its child components to render a clientId value without any prefix.

Important: this component works only when run in a JSF-1.2 (or later) environment. When run in a JSF-1.1 environment it will not cause an error, but will instead act like a NamingContainer itself, ie will add its own id to the child component's clientId.

Every JSF component has a "clientId" property; when the component is rendered, many components output this as part of the rendered representation. In particular, when rendering HTML, many components write an "id" attribute on their html element which contains the clientId. The clientId is defined as being the clientId value of the nearest NamingContainer ancestor plus ":" plus the component's id.

The prefixing of the parent container's clientId is important for safely building views from multiple files (eg using Facelets templating or JSP includes). However in some cases it is necessary or useful to render a clientId which is just the raw id of the component without any naming-container prefix; this component can be used to do that simply by adding an instance of this type as an ancestor of the problem components. This works for all JSF components, not just Tomahawk ones.

Use of this component should be a "last resort"; having clientIds which contain the id of the ancestor NamingContainer is important and useful behaviour. It allows a view to be built from multiple different files (using facelets templating or jsp includes); without this feature, component ids would need to be very carefully managed to ensure the same id was not used in two places. In addition, it would not be possible to include the same page fragment twice.

Ids are sometimes used by Cascading Style Sheets to address individual components, and JSF compound ids are not usable by CSS. However wherever possible use a style class to select the component rather than using this component to assign a "global" id.

Ids are sometimes used by javascript "onclick" handlers to locate HTML elements associated with the clicked item (document.getById). Here, the onclick handler method can be passed the id of the clicked object, and some simple string manipulation can then compute the correct clientId for the target component, rather than using this component to assign a "global" id to the component to be accessed.

This component is similar to the "forceId" attribute available on many Tomahawk components. Unlike the forceId attribute this (a) can be used with all components, not just Tomahawk ones, and (b) applies to all its child components.

Note that since JSF1.2 forms have the property prefixId which can be set to false to make a UIForm act as if it is not a NamingContainer. This is a good idea; the form component should probably never have been a NamingContainer, and disabling this has no significant negative effects.

Tag Information
Tag Classorg.apache.myfaces.custom.globalId.GlobalIdTag
TagExtraInfo ClassNone
Body ContentJSP
Display NameNone

idfalsetruejava.lang.StringGet a string which uniquely identifies this UIComponent within the scope of the nearest ancestor NamingContainer component. The id is not necessarily unique across all components in the current view.
(must evaluate to boolean)
A boolean value that indicates whether this component should be rendered. Default value: true.
(must evaluate to javax.faces.component.UIComponent)
Identifies a backing bean property (of type UIComponent or appropriate subclass) to bind to this component instance. This value must be an EL expression.

No Variables Defined.

Output Generated by Tag Library Documentation Generator. Java, JSP, and JavaServer Pages are trademarks or registered trademarks of Sun Microsystems, Inc. in the US and other countries. Copyright 2002-4 Sun Microsystems, Inc. 4150 Network Circle Santa Clara, CA 95054, U.S.A. All Rights Reserved.