The <o:tagAttribute> is a tag handler that can be used to explicitly declare a tag attribute on a Facelets tag file. This makes sure that
any tag attribute with the same name on a parent tag file is cleared out, which does not properly happen in Mojarra.
Consider the following custom tag structure:
<my:tag id="foo">
<my:tag id="bar" />
</my:tag>
Inside the nested tag, the #{id} will just evaluate to "bar". However, if this isn't declared on the nested tag like so,
<my:tag id="foo">
<my:tag />
</my:tag>
then #{id} of the nested tag would evaluate to "foo" instead of null, even when you explicitly specify the attribute
in the *.taglib.xml file.
This tag handler is designed to overcome this peculiar problem and unintuitive behavior of nested tagfiles in Mojarra.
Just declare the attribute name in top of the tagfile as below.
<o:tagAttribute name="id" />
You can optionally provide a default value.
<o:tagAttribute name="type" default="text" />Since OmniFaces 2.7/3.2 there is a special case for a
<o:tagAttribute name="id"> without a default value: it will override any
autogenerated ID into the form of j_ido[tagId] where [tagId] is the <o:tagAttribute> tag's own unique ID. This
is autogenerated per tag file invocation, so nested invocations of the same tag file each get their own ID.
The declaration only shields against enclosing tag files which declare their attributes as well, so every tag file in a nesting chain must declare its attributes. A tag file which does not declare them is not a scope boundary, and whether its attributes are then visible to a nested tag file is up to the Faces implementation.
Only a tag attribute of an enclosing tag file is shielded. A variable of the same name which an enclosing tag file did not declare as a tag attribute, such
as one set by <ui:param> or <c:set>, is left alone, and whether it is visible inside a nested tag file at all is up to
the Faces implementation. Setting a name which the same tag file already declared keeps that name shielded for the remainder of that tag file. Declaring the
attribute also does not affect the enclosing tag file: it keeps its own value in the markup which follows the nested tag file.
Output generated by Vdldoc View Declaration Language Documentation Generator.