code: @Override
      public void doTag() throws JspException, IOException {
          PageContext         pageContext = (PageContext) getJspContext();
          HttpServletRequest  request     = (HttpServletRequest) pageContext.getRequest();
          HttpServletResponse response    = (HttpServletResponse) pageContext.getResponse();
          HttpSession         session     = request.getSession();
  
  
          if (TagUtils.isELValue(getValue())) {
              Object var = TagUtils.getElValue(getJspContext(), TagUtils.getElName(getValue()));
              if (var != null) {
                  setValue(var);
              }
          }
  
          if (StringUtils.equalsIgnoreCase(getScope(), "request")) {
              request.setAttribute(getName(), getValue());
          } else if (StringUtils.equalsIgnoreCase(getScope(), "session")) {
              session.setAttribute(getName(), getValue());
          } else if (StringUtils.equalsIgnoreCase(getScope(), "cookie")) {
              Cookie cookie = new Cookie(getName(), TagUtils.getCookieValue(getValue()));
  
              // TODO support "Comment" // rfc2019, "Discard" // 2019++, "Expires" // (old cookies), "Secure", "Version"
              if (dynamicAttrMap.containsKey("domain")) {
                  cookie.setDomain(ObjectUtils.toString(dynamicAttrMap.get("domain")));
              }
              if (dynamicAttrMap.containsKey("path")) {
                  cookie.setPath(ObjectUtils.toString(dynamicAttrMap.get("path")));
              }
              if (dynamicAttrMap.containsKey("maxAge")) {
                  int maxAge = NumberUtils.toInt(ObjectUtils.toString(dynamicAttrMap.get("maxAge")), (60*60*24*7)); // default value 1 week(60*60*24*7)
                  cookie.setMaxAge(maxAge); //seconds
              }
              response.addCookie(cookie);
          } else {
              throw new IllegalArgumentException(String.format("[%s] is undefined scope value", this.getScope()));
          }
      }
docs: override doTag method