@ Override public int doEndTag ( ) throws JspException { Tag t = findAncestorWithClass ( this , ParamParent . class ) ; if ( t == null ) { throw new JspTagException ( Resources . getMessage ( "PARAM_OUTSIDE_PARENT" ) ) ; } // take no action for null or empty names if ( name == null || name . equals ( "" ) ) { return EVAL_PAGE ; } // send the parameter to the appropriate ancestor ParamParent parent = ( ParamParent ) t ; String value = this . value ; if ( value == null ) { if ( bodyContent == null || bodyContent . getString ( ) == null ) { value = "" ; } else { value = bodyContent . getString ( ) . trim ( ) ; } } if ( encode ) { String enc = pageContext . getResponse ( ) . getCharacterEncoding ( ) ; try { parent . addParameter ( URLEncoder . encode ( name , enc ) , URLEncoder . encode ( value , enc ) ) ; } catch ( UnsupportedEncodingException e ) { throw new JspTagException ( e ) ; } } else { parent . addParameter ( name , value ) ; } return EVAL_PAGE ; }
simply send our name and value to our appropriate ancestor