public int doStartTag() throws JspException {

        // Locate our parent UIComponentTag
        UIComponentClassicTagBase tag =
             UIComponentClassicTagBase.getParentUIComponentClassicTagBase(pageContext);
        if (tag == null) { // PENDING - i18n
            throw new JspException("Not nested in a UIComponentTag");
        }

        // Add this attribute if it is not already defined
        UIComponent component = tag.getComponentInstance();
        if (component == null) { // PENDING - i18n
            throw new JspException("No component associated with UIComponentTag");
        }

        FacesContext context = FacesContext.getCurrentInstance();
        ExpressionFactory exprFactory =
            context.getApplication().getExpressionFactory();
        ELContext elContext = context.getELContext();

        String nameVal = (String) 
                  exprFactory.createValueExpression(elContext, name, String.class)
                      .getValue(elContext);
        Object valueVal =
                exprFactory.createValueExpression(elContext, value, Object.class)
                    .getValue(elContext);

        if (component.getAttributes().get(nameVal) == null) {
            component.getAttributes().put(nameVal, valueVal);
        }
        return (SKIP_BODY);

    }
public int doStartTag ( ) throws JspException { UIComponentClassicTagBase tag = UIComponentClassicTagBase . getParentUIComponentClassicTagBase ( pageContext ) ; if ( tag == null ) { throw new JspException ( "Not nested in a UIComponentTag" ) ; } UIComponent component = tag . getComponentInstance ( ) ; if ( component == null ) { throw new JspException ( "No component associated with UIComponentTag" ) ; } FacesContext context = FacesContext . getCurrentInstance ( ) ; ExpressionFactory exprFactory = context . getApplication ( ) . getExpressionFactory ( ) ; ELContext elContext = context . getELContext ( ) ; String nameVal = ( String ) exprFactory . createValueExpression ( elContext , name , String . class ) . getValue ( elContext ) ; Object valueVal = exprFactory . createValueExpression ( elContext , value , Object . class ) . getValue ( elContext ) ; if ( component . getAttributes ( ) . get ( nameVal ) == null ) { component . getAttributes ( ) . put ( nameVal , valueVal ) ; } return ( SKIP_BODY ) ; }
<p>Register the specified attribute name and value with the
{@link UIComponent} instance associated with our most immediately
surrounding {@link UIComponentTag} instance, if this {@link UIComponent}
does not already have a value for the specified attribute name.</p>

@throws JspException if a JSP error occurs