Top Description Fields Constructors Methods
javax.faces.webapp

public abstract Class UIComponentClassicTagBase

extends UIComponentTagBase
implements JspIdConsumer, BodyTag
Class Inheritance
All Implemented Interfaces
javax.servlet.jsp.tagext.BodyTag, javax.servlet.jsp.tagext.IterationTag, javax.servlet.jsp.tagext.Tag, javax.servlet.jsp.tagext.JspTag, javax.servlet.jsp.tagext.JspIdConsumer
Known Direct Subclasses
javax.faces.webapp.UIComponentELTag, javax.faces.webapp.UIComponentTag
Imports
javax.faces.FacesException, javax.faces.application.Application, javax.faces.component.NamingContainer, .UIComponent, .UIOutput, .UIViewRoot, javax.faces.context.FacesContext, javax.servlet.jsp.JspException, .JspWriter, .PageContext, javax.servlet.jsp.tagext.BodyContent, .BodyTag, .JspIdConsumer, .Tag, java.io.IOException, .StringWriter, .Writer, java.util.ArrayList, .HashMap, .HashSet, .List, .Map, .RandomAccess, .Set, java.util.concurrent.atomic.AtomicInteger, java.util.logging.Level

UIComponentTagBase is the base class for all JSP tags that use the "classic" JSP tag interface that correspond to a javax.faces.component.UIComponent instance in the view. In Faces 1.2, all component tags are BodyTag instances to allow for the execution of the page to build the component tree, but not render it. Rendering happens only after the component tree is completely built.

UIComponentTag extends UIComponentClassicTagBase to add support for properties that conform to the Faces 1.1 EL.

UIComponentELTag extends UIComponentClassicTagBase class to add support for properties that conform to the EL API.

The default implementation allows the proper interweaving of template text, non-Faces JSP tag output, and Faces component tag output in the same page, as expected by the page author.

The CASE markers in the following example will be cited in the method descriptions of this class.



<h:panelGrid style="color:red" border="4" columns="2">
CASE 1
<h:outputText value="component 1"/>
CASE 2
<h:outputText value="component 2"/>
<f:verbatim>CASE 3</f:verbatim>
<c:out value="${pageScope.CASE4}" />
</h:panelGrid>

The preceding arrangement of faces component tags, must yield markup that will render identically to the following (assuming that ${pageScope.CASE4} evaluates to "CASE 4" without the quotes).



<table border="4" style="color:red">

<tbody>

<tr><td>CASE 1</td></tr> <tr><td>component 1</td></tr>

<tr><td>CASE 2</td> <tr><td>component 2</td></tr>

<tr><td>CASE 3</td> <td>CASE 4</td></tr>

</tbody>

</table>

Field Summary

Modifier and TypeField and Description
private int
_nextChildIndex

The next child index to get in getChild()

protected BodyContent
bodyContent

The bodyContent for this tag handler.

private UIComponent
component

The UIComponent that is being encoded by this tag, if any.

private static final String
COMPONENT_TAG_STACK_ATTR

The facesContext scope attribute under which a component tag stack for the current facesContext will be maintained.

private FacesContext
context

The FacesContext for the request being processed, if any.

private boolean
created

Was a new component instance dynamically created when our findComponent() method was called.

private List<String>
createdComponents

The Lst of UIComponent ids created or located by nested UIComponentTags while processing the current request.

private List<String>
createdFacets

The List of facet names created or located by nested UIComponentTags while processing the current request.

private static final String
CURRENT_FACES_CONTEXT

The attribute name under which we will store the FacesContext for this request.

private static final String
CURRENT_VIEW_ROOT

The attribute name under which we will store the UIViewRoot for this request.

private String
facesJspId

This is simply the jspId prefixed by UNIQUE_ID_PREFIX.

private static final String
GLOBAL_ID_VIEW

The attribute name under which we will store all UIComponent IDs of the current translation unit.

private String
id

The component identifier for the associated component.

private boolean
isNestedInIterator

Set to true if this component is nested inside of an iterating tag

private static final String
JAVAX_FACES_PAGECONTEXT_COUNTER

This is a facesContext scoped attribute which contains an AtomicInteger which we use to increment the PageContext count.

private static final String
JAVAX_FACES_PAGECONTEXT_MARKER

This is a Page scoped marker to help us keep track of the different execution context we could be operating within, e.g. an include, or a tag file.

private static final String
JSP_CREATED_COMPONENT_IDS

The UIComponent attribute under which we will store a List of the component identifiers of child components created on the previous generation of this page (if any).

private static final String
JSP_CREATED_FACET_NAMES

The UIComponent attribute under which we will store a List of the facet names of facets created on the previous generation of this page (if any).

private String
pack-priv Map<String, Map<String, UIComponentTagBase>>
protected PageContext
pageContext

The JSP PageContext for the page we are embedded in.

private Tag
parent

The JSP Tag that is the parent of this tag.

private UIComponentClassicTagBase
parentTag

Caches the nearest enclosing UIComponentClassicTagBase of this tag.

private static final String
PREVIOUS_JSP_ID_SET

Used to store the previousJspId Map in facesContextScope

protected static final String
UNIQUE_ID_PREFIX

Used as the prefix for ids.

Inherited from javax.faces.webapp.UIComponentTagBase:
log

Constructor Summary

AccessConstructor and Description
public
pack-priv

Method Summary

Modifier and TypeMethod and Description
private static UIComponentClassicTagBase
private static UIComponentClassicTagBase
private static int

Returns:

The index at which the value was first found, or -1 if not found
_indexOfStartingFrom
(List<?>
List to seatch
list
,
int
index to start searching for value from
startIndex
,
Object
Value to search for (null not supported)
searchValue
)

Similar to List.indexOf, except that we start searching from a specific index and then wrap aroud.

protected void
addChild(UIComponent
New child whose identifier should be added
child
)

Implements abstract javax.faces.webapp.UIComponentTagBase.addChild.

Add the component identifier of the specified UIComponent to the list of component identifiers created or located by nested UIComponentTags processing this request.

pack-priv void
protected void
addFacet(String
Facet name to be added
name
)

Implements abstract javax.faces.webapp.UIComponentTagBase.addFacet.

Add the facet name of the specified facet to the list of facet names created or located by nested UIComponentTags processing this request.

protected void
addVerbatimAfterComponent(UIComponentClassicTagBase
the parent tag
parentTag
,
UIComponent
the verbatim to add after the component
verbatim
,
UIComponent
the component to be added before the component
component
)

Add verbatim as a sibling of component in component in the parent's child list.

protected void
addVerbatimBeforeComponent(UIComponentClassicTagBase
the parent tag
parentTag
,
UIComponent
the verbatim to add before the component
verbatim
,
UIComponent
the component to be added after the component
component
)

Add verbatim as a sibling of component in component in the parent's child list.

private UIComponent
createChild(FacesContext
FacesContext for the current request
context
,
UIComponent
Parent UIComponent for the new child
parent
,
UIComponentClassicTagBase parentTag, String
Component identifier for the new child, or null for no explicit identifier
componentId
)

Create a new child component using createComponent, initialize its properties, and add it to its parent as a child.

protected abstract UIComponent

Returns:

the created component
createComponent
(FacesContext
FacesContext for the current request
context
,
String
id of the component
newId
)

Create and return a new child component of the type returned by calling getComponentType().

private UIComponent
createFacet(FacesContext
FacesContext for the current request
context
,
UIComponent
Parent UIComponent of the new facet
parent
,
String
Name of the new facet
name
,
String
id of the new facet
newId
)

Create a new child component using createComponent, initialize its properties, and add it to its parent as a facet.

private String
createId(FacesContext context)

Create the component identifier to be used for this component.

protected UIOutput

Returns:

the component
createVerbatimComponent
()

Use the Application instance to create a new component with the following characteristics.

protected UIComponent

Returns:

the component
createVerbatimComponentFromBodyContent
()

Create a transient UIOutput component from the body content, of this tag instance or return null if there is no body content, the body content is whitespace, or the body content is a comment.

public int
doAfterBody()

Implements javax.servlet.jsp.tagext.IterationTag.doAfterBody.

Perform any processing necessary to handle the content implications of CASE 4 in the class description.

public int
doEndTag()

Implements javax.servlet.jsp.tagext.Tag.doEndTag.

Perform any processing necessary to handle the content implications of CASE 3 in the class description.

public void
doInitBody()

Implements javax.servlet.jsp.tagext.BodyTag.doInitBody.

Prepare for evaluation of the body.

public int
doStartTag()

Implements javax.servlet.jsp.tagext.Tag.doStartTag.

Perform any processing necessary to find (or create) the UIComponent instance in the view corresponding to this tag instance in the page and, if and only if a component was created, insert it into the tree at the proper location as expected by the page author.

protected void
encodeBegin()

Deprecated No encoding is done during JSP page execution. Encoding is deferred until the page has completed executing to allow the entire tree to be built before any encoding occurs.

Delegate to the encodeBegin() method of our corresponding UIComponent.

protected void
encodeChildren()

Deprecated No encoding is done during JSP page execution. Encoding is deferred until the page has completed executing to allow the entire tree to be built before any encoding occurs.

Delegate to the encodeChildren() method of our corresponding UIComponent.

protected void
encodeEnd()

Deprecated No encoding is done during JSP page execution. Encoding is deferred until the page has completed executing to allow the entire tree to be built before any encoding occurs.

Delegate to the encodeEnd() method of our corresponding UIComponent.

protected UIComponent

Returns:

the found component
findComponent
(FacesContext
the FacesContext for the current request.
context
)

Find and return the UIComponent, from the component tree, that corresponds to this tag handler instance.

private String
public BodyContent
private static UIComponent
getChild(UIComponentClassicTagBase tag, UIComponent
UIComponent to be searched
component
,
String
Component id to search for
componentId
)

Return a child with the specified component id from the specified component, if any; otherwise, return null.

public UIComponent
getComponentInstance()

Implements abstract javax.faces.webapp.UIComponentTagBase.getComponentInstance.

Return the UIComponent instance that is associated with this tag instance.

public boolean
getCreated()

Implements abstract javax.faces.webapp.UIComponentTagBase.getCreated.

Return true if we dynamically created a new component instance during execution of this tag.

protected List<String>

Returns:

the created components
getCreatedComponents
()

Returns the List of UIComponent ids created or located by nested UIComponentTags while processing the current request.

protected int

Returns:

the value to return from doAfterBody()
getDoAfterBodyValue
()

Return the flag value that should be returned from the doAfterBody() method when it is called.

protected int

Returns:

the value to return from doEnd()
getDoEndValue
()

Return the flag value that should be returned from the doEnd() method when it is called.

protected int

Returns:

the value to return from doStart()
getDoStartValue
()

Return the flag value that should be returned from the doStart() method when it is called.

protected FacesContext
getFacesContext()

Implements abstract javax.faces.webapp.UIComponentTagBase.getFacesContext.

Return the FacesContext instance for the current request.

private static FacesContext
protected String

Returns:

the value as specified above
getFacesJspId
()

If this method has been called before on this tag's useful lifetime (before release was called), return the previously returned value.

protected String

Returns:

the name of the facet
getFacetName
()

Return the facet name that we should be stored under, if any; otherwise, return null (indicating that we will be a child component).

protected String

Returns:

the id of this tag
getId
()

Return the id value assigned by the page author.

protected int
getIndexOfNextChildTag()

Implements abstract javax.faces.webapp.UIComponentTagBase.getIndexOfNextChildTag.

Return the index of the next child to be added as a child of this tag.

public String
private Map<K, V>
public Tag
getParent()

Implements javax.servlet.jsp.tagext.Tag.getParent.

Return the Tag that is the parent of this instance.

private UIComponentClassicTagBase

Returns:

the parent tag that represents the closest NamingContainer component.
getParentNamingContainerTag
()

public static UIComponentClassicTagBase

Returns:

the parent tag
getParentUIComponentClassicTagBase
(PageContext
PageContext for the current page
context
)

Locate and return the nearest enclosing UIComponentClassicTagBase if any; otherwise, return null.

public JspWriter

Returns:

the writer
getPreviousOut
()

Get the JspWriter from our BodyContent.

protected abstract boolean

Returns:

whether or not this component has a binding attribute
hasBinding
()

Return true if this component has a non-null binding attribute.

private static void
indentPrintln(Writer out, String str, int curDepth)

private boolean

Returns:

true if this nested with facesJspId is duplicate.
isDuplicateId
(String
id to be looked up for possible duplication.
componentId
)

Returns true if a component already exists with the same id.

private boolean

Returns:

true if this ID is unique within the closest naming container, otherwise false
isSpecifiedIdUnique
(String
the component ID
id
)

private void
popUIComponentClassicTagBase()

Pop the top UIComponentTag instance off of our component tag stack, deleting the stack if this was the last entry.

private static void
printTree(UIComponent root, String duplicateId, Writer out, int curDepth)

private void
pushUIComponentClassicTagBase()

Push the specified UIComponentTag instance onto our component tag stack, creating a stack if necessary.

public void
release()

Implements javax.servlet.jsp.tagext.Tag.release.

Release any resources allocated during the execution of this tag handler.

private void
removeOldChildren()

Retrieve from the UIComponent corresponding to this tag handler the list of all child component ids created by UIComponentTag instances the previous time this tree was rendered.

private void
removeOldFacets()

Retrieve from the UIComponent corresponding to this tag handler the list of all facet names created by UIComponentTag instances the previous time this tree was rendered.

public void
setBodyContent(BodyContent
The new BodyContent for this tag
bodyContent
)

Implements javax.servlet.jsp.tagext.BodyTag.setBodyContent.

Set the bodyContent for this tag handler.

public void
setId(String
The new component identifier. This may not start with UIViewRoot#UNIQUE_ID_PREFIX.
id
)

Implements abstract javax.faces.webapp.UIComponentTagBase.setId.

Set the component identifier for our component.

public void
setJspId(String
the container generated id for this tag, guaranteed to be unique within the page.
id
)

Implements javax.servlet.jsp.tagext.JspIdConsumer.setJspId.

Defined on JspIdConsumer.

public void
setPageContext(PageContext
The enclosing PageContext
pageContext
)

Implements javax.servlet.jsp.tagext.Tag.setPageContext.

Set the PageContext of the page containing this tag instance.

public void
setParent(Tag
The new parent Tag
parent
)

Implements javax.servlet.jsp.tagext.Tag.setParent.

Set the Tag that is the parent of this instance.

protected abstract void
setProperties(UIComponent
UIComponent whose properties are to be overridden
component
)

Override properties and attributes of the specified component, if the corresponding properties of this tag handler instance were explicitly set.

protected void
setupResponseWriter()

Set up the javax.faces.context.ResponseWriter for the current response, if this has not been done already.

private void
updatePreviousJspIdAndIteratorStatus(String
the id to be compared with the previous id, if any, for this tag instance on this request.
id
)

Called from setJspId to update the value saved for the previous call to setJspId for this component on this request.

Inherited from javax.faces.webapp.UIComponentTagBase:
getComponentTypegetELContextgetRendererType