public class TagAttribute extends TagHandler
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,
and provides a way to set the default value.
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}
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.
Just declare the attribute name in top of the tagfile as below.
<o:tagAttribute name="id" />
nextHandler, tag, tagId
Constructor and Description |
---|
TagAttribute(TagConfig config) |
Modifier and Type | Method and Description |
---|---|
void |
apply(FaceletContext context,
UIComponent parent) |
getAttribute, getRequiredAttribute, toString
public TagAttribute(TagConfig config)
public void apply(FaceletContext context, UIComponent parent) throws IOException
IOException
Copyright © 2012–2015 OmniFaces. All rights reserved.