code: protected void setAttribute(String key, Object value, int scope) {
          Map<String, Object> replacedInScope = getReplacedAttributes(scope);
          if (!replacedInScope.containsKey(key)) {
              Object current = pageContext.getAttribute(key, scope);
              replacedInScope.put(key, current);
          }
          pageContext.setAttribute(key, value, scope);
      }
docs: each attribute set by a tag should use this method for attribute declaration;
  an existing value with the same key is registered and restored if the tag rendering ends