Start line:  
End line:  

Snippet Preview

Snippet HTML Code

Stack Overflow Questions
   * Copyright (c) 1997-2010 Oracle and/or its affiliates. All rights reserved.
   * The contents of this file are subject to the terms of either the GNU
   * General Public License Version 2 only ("GPL") or the Common Development
   * and Distribution License("CDDL") (collectively, the "License").  You
   * may not use this file except in compliance with the License.  You can
  * obtain a copy of the License at
  * or packager/legal/LICENSE.txt.  See the License for the specific
  * language governing permissions and limitations under the License.
  * When distributing the software, include this License Header Notice in each
  * file and include the License file at packager/legal/LICENSE.txt.
  * GPL Classpath Exception:
  * Oracle designates this particular file as subject to the "Classpath"
  * exception as provided by Oracle in the GPL Version 2 section of the License
  * file that accompanied this code.
  * Modifications:
  * If applicable, add the following below the License Header, with the fields
  * enclosed by brackets [] replaced by your own identifying information:
  * "Portions Copyright [year] [name of copyright owner]"
  * Contributor(s):
  * If you wish your version of this file to be governed by only the CDDL or
  * only the GPL Version 2, indicate your decision by adding "[Contributor]
  * elects to include this software in this distribution under the [CDDL or GPL
  * Version 2] license."  If you don't indicate a single choice of license, a
  * recipient has the option to distribute your version of this file under
  * either the CDDL, the GPL Version 2 or to extend the choice of license to
  * its licensees as provided above.  However, if you add GPL Version 2 code
  * and therefore, elected the GPL Version 2 license, then the option applies
  * only if the new code is made subject to such option by the copyright
  * holder.
 package javax.faces.webapp;

UIComponentELTag specializes its superclass to allow for properties that take their values from EL API expressions.

This tag is designed for use with Faces version 1.2 and JSP version 2.1 containers.

 public abstract class UIComponentELTag extends UIComponentClassicTagBase implements Tag {
     // ------------------------------------------------------------- Attributes


The value binding expression (if any) used to wire up this component to a javax.faces.component.UIComponent property of a JavaBean class.

     private ValueExpression binding = null;


Set the value expression for our component.

binding The new value expression
javax.servlet.jsp.JspException if an error occurs
     public void setBinding(ValueExpression bindingthrows JspException {
 	this. = binding;
     protected boolean hasBinding() {
 	return null != ;


An override for the rendered attribute associated with our javax.faces.component.UIComponent.

     private ValueExpression rendered = null;


Set an override for the rendered attribute.

rendered The new value for rendered attribute
    public void setRendered(ValueExpression rendered) {
        this. = rendered;


Return the javax.el.ELContext for the javax.faces.context.FacesContext for this request.

This is a convenience for getFacesContext().getELContext().

    protected ELContext getELContext() {
	ELContext result = null;
	if (null != fc) {
	    result = fc.getELContext();
	return result;
    // ------------------------------------------------------------ Tag Methods


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

    public void release() {
	this. = null;
        this. = null;
    // ------------------------------------------------------- Protected Methods


Override properties and attributes of the specified component, if the corresponding properties of this tag handler instance were explicitly set. This method must be called ONLY if the specified javax.faces.component.UIComponent was in fact created during the execution of this tag handler instance, and this call will occur BEFORE the javax.faces.component.UIComponent is added to the view.

Tag subclasses that want to support additional set properties must ensure that the base class setProperties() method is still called. A typical implementation that supports extra properties foo and bar would look something like this:

 protected void setProperties(UIComponent component) {
   if (foo != null) {
     component.setAttribute("foo", foo);
   if (bar != null) {
     component.setAttribute("bar", bar);

The default implementation overrides the following properties:

  • rendered - Set if a value for the rendered property is specified for this tag handler instance.
  • rendererType - Set if the getRendererType() method returns a non-null value.

component javax.faces.component.UIComponent whose properties are to be overridden
    protected void setProperties(UIComponent component) {
        // The "id" property is explicitly set when components are created
        // so it does not need to be set here
        if ( != null) {
            if (.isLiteralText()) {
                try {
                } catch (ELException e) {
                    throw new FacesException(e);
            } else {
        if (getRendererType() != null) {


Create and return a new child component of the type returned by calling getComponentType(). If this UIComponentELTag has a non-null binding attribute, this is done by call javax.faces.application.Application.createComponent(java.lang.String) with the javax.el.ValueExpression created for the binding attribute, and the javax.el.ValueExpression will be stored on the component. Otherwise, javax.faces.application.Application.createComponent(java.lang.String) is called with only the component type. Finally, initialize the components id and other properties.

context javax.faces.context.FacesContext for the current request
newId id of the component
    protected UIComponent createComponent(FacesContext contextString newIdthrows JspException {
        UIComponent component;
        Application application = context.getApplication();
        if ( != null) {
            component = application.createComponent(context,
        } else {
            component = application.createComponent(getComponentType());
        return component;
New to GrepCode? Check out our FAQ X