code: @Override
      public int doEndTag() throws JspException {
          charEncoding = value;
          if ((charEncoding == null)
                  && (pageContext.getRequest().getCharacterEncoding() == null)) {
              // Use charset from session-scoped attribute
              charEncoding = (String)
                      pageContext.getAttribute(REQUEST_CHAR_SET,
                              PageContext.SESSION_SCOPE);
              if (charEncoding == null) {
                  // Use default encoding
                  charEncoding = DEFAULT_ENCODING;
              }
          }
  
          /*
         * If char encoding was already set in the request, we don't need to
         * set it again.
         */
          if (charEncoding != null) {
              try {
                  pageContext.getRequest().setCharacterEncoding(charEncoding);
              } catch (UnsupportedEncodingException uee) {
                  throw new JspTagException(uee.toString(), uee);
              }
          }
  
          return EVAL_PAGE;
      }
docs: Tag logic