code: @Override
      public int doEndTag() throws JspException {
  
          // decide what to do with the result
          if (var != null) {
              exportToVariable(getResult());
          } else {
              Object target = evalTarget();
              if (target == null) {
                  // can happen if target evaluates to null
                  throw new JspTagException(Resources.getMessage("SET_INVALID_TARGET"));
              }
  
              String property = evalProperty();
              if (target instanceof Map) {
                  exportToMapProperty(target, property, getResult());
              } else {
                  exportToBeanProperty(target, property, getResult());
              }
          }
  
          return EVAL_PAGE;
      }
docs: Tag logic