code: public Object getAttribute(String key, Object defaultValue)
      {
          Object attributeValue = getUserAttribute(key, null);
          if (attributeValue != null)
              return attributeValue;
          attributeValue = getSessionAttribute(key, null);
          if (attributeValue != null)
              return attributeValue;
          return defaultValue;
      }
docs: Get a value from the user OR session attributes map.
  
  @param key
  name of the attribute
  @param defaultValue
  a default value to return if no value is found.
  @return the attribute value