@Override
  public void decode(FacesContext context, UIComponent component) {
    // Get the UIInputEx
    if (!(component instanceof UIInputEx)) {
      return;
    }
    UIInputEx uiInput = (UIInputEx) component;

    // If the component is disabled, do not change the value of the
    // component, since its state cannot be changed.
    if (ReadOnlyAdapterRenderer.isReadOnly(context, uiInput)) {
      return;
    }

    String clientId = uiInput.getClientId(context);
    Map<?, ?> requestMap = context.getExternalContext().getRequestParameterMap();

    // Don't overwrite the value unless you have to!
    if (requestMap.containsKey(clientId)) {
      String newValue = (String) requestMap.get(clientId);

      // Apply the HTML filter in if applicable
      if (component instanceof FacesInputFiltering) {
        String filterIn = ((FacesInputFiltering) component).getHtmlFilterInName();
        if (filterIn != null) {
          newValue = ((FacesContextEx) context).filterHtml(filterIn, newValue);
        }
      }

      uiInput.setSubmittedValue(newValue);
    } else { // will only occur if the control is disabled (empty control submits empty string)
      Object newValue = uiInput.getDefaultValue();
      if (newValue != null) {
        // convert Date default value to string
        String newValueStr = getDefaultValueAsString(context, uiInput, newValue);
        uiInput.setSubmittedValue(newValueStr);
      }
    }
  }
  private void writeTagHtmlAttributes(
      FacesContext context, UIInput component, ResponseWriter writer, String currentValue)
      throws IOException {
    XspInputText tcomponent = (XspInputText) component;

    // this mostly encodes the same attributes as the superclass,
    // except for the event attributes, which are encoded in writeTagEventAttributes
    // and it also encodes the TEXT_ATTRS listed above.

    // accessKey
    String accesskey = tcomponent.getAccesskey();
    if (accesskey != null) {
      writer.writeAttribute("accesskey", accesskey, "accesskey"); // $NON-NLS-1$ $NON-NLS-2$
    }

    // autoComplete
    String autoComplete = tcomponent.getAutocomplete();
    if (autoComplete != null) {
      // only output the autocomplete attribute if the value
      // is 'off' since its lack of presence will be interpreted
      // as 'on' by the browser
      if ("off".equals(autoComplete)) { // $NON-NLS-1$
        writer.writeAttribute(
            "autocomplete", "off", "autocomplete"); // $NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
      }
    }

    // dir
    String dir = tcomponent.getDir();
    if (dir != null) {
      writer.writeAttribute("dir", dir, "dir"); // $NON-NLS-1$ $NON-NLS-2$
    }

    // role
    String role = tcomponent.getRole();
    if (role != null) {
      writer.writeAttribute("role", role, "role"); // $NON-NLS-1$ $NON-NLS-2$
    }

    // aria-required
    if (tcomponent.isRequired()) {
      writer.writeAttribute("aria-required", "true", null); // $NON-NLS-1$ //$NON-NLS-2$
    }

    // aria-invalid
    if (!tcomponent.isValid()) {
      writer.writeAttribute("aria-invalid", "true", null); // $NON-NLS-1$ //$NON-NLS-2$
    }

    // disabled.
    boolean disabled = tcomponent.isDisabled();
    if (disabled) {
      // note, write disabled="disabled" (not disabled="true")
      writer.writeAttribute(
          "disabled", "disabled", "disabled"); // $NON-NLS-1$ $NON-NLS-2$ //$NON-NLS-3$
    }

    // lang
    String lang = tcomponent.getLang();
    if (lang != null) {
      writer.writeAttribute("lang", lang, "lang"); // $NON-NLS-1$ $NON-NLS-2$
    }

    // maxlength
    int maxlength = tcomponent.getMaxlength();
    if (maxlength >= 0) {
      writer.writeAttribute("maxlength", maxlength, "maxlength"); // $NON-NLS-1$ $NON-NLS-2$
    }

    // readonly
    boolean readonly = ReadOnlyAdapterRenderer.isReadOnly(context, component);
    if (readonly) {
      writer.writeAttribute(
          "readonly", "readonly", "readonly"); // $NON-NLS-1$ $NON-NLS-2$ $NON-NLS-3$
    }

    // size
    int size = tcomponent.getSize();
    if (size >= 0) {
      writer.writeAttribute("size", size, "size"); // $NON-NLS-1$ $NON-NLS-2$
    }

    // style
    String style = tcomponent.getStyle();
    if (style != null) {
      writer.writeAttribute("style", style, "style"); // $NON-NLS-1$ $NON-NLS-2$
    }

    // styleClass
    String styleClass = tcomponent.getStyleClass();
    if (styleClass != null) {
      writer.writeAttribute("class", styleClass, "styleClass"); // $NON-NLS-2$ $NON-NLS-1$
    }

    // tabindex
    String tabindex = tcomponent.getTabindex();
    if (tabindex != null) {
      writer.writeAttribute("tabindex", tabindex, "tabindex"); // $NON-NLS-1$ $NON-NLS-2$
    }

    // title
    String title = tcomponent.getTitle();
    if (title != null) {
      writer.writeAttribute("title", title, "title"); // $NON-NLS-1$ $NON-NLS-2$
    }
  }