code: private boolean createPageAnchor(ServletRequest req, TagRenderingBase trb)
      {
          // create the fragment identifier.  If the _linkName starts with
          // '#' then we treat it as if it was fully qualified.  Otherwise we
          // need to qualify it before we add the '#'.
          _linkName = _linkName.trim();
          if (_linkName.charAt(0) != '#') {
              _state.href = "#" + getIdForTagId(_linkName);
          }
          else {
              _state.href = _linkName;
          }
  
          // if the tagId was set then rewrite it and output it.
          if (_state.id != null) {
              //_state.id = getIdForTagId(_state.id);
              _state.name = _state.id;
              renderNameAndId((HttpServletRequest) req, _state,null);
              //renderDefaultNameAndId((HttpServletRequest) req, _state, _state.id, _state.id);
          }
  
          // write out the tag.
          WriteRenderAppender writer = new WriteRenderAppender(pageContext);
          trb = TagRenderingBase.Factory.getRendering(TagRenderingBase.ANCHOR_TAG, req);
          trb.doStartTag(writer, _state);
          return !hasErrors();
      }
docs: This method will output an anchor with a fragment identifier.  This should
  be a valid ID within the document.  If the name begins with the "#" we will
  not qualify the set link name.  If the name doesn't begin with #, then we
  will qualify it into the current scope container.
  @param req The servlet request.
  @param trb The TagRenderer that will output the link
  @return return a boolean indicating if an error occurred or not