/**
   * Renders the '{@code input(radio)}' element with the configured {@link #setValue(Object) value}.
   * Marks the element as checked if the value matches the {@link #getValue bound value}.
   */
  @Override
  protected int writeTagContent(TagWriter tagWriter) throws JspException {
    tagWriter.startTag("input");
    String id = resolveId();
    writeOptionalAttribute(tagWriter, "id", id);
    writeOptionalAttribute(tagWriter, "name", getName());
    writeOptionalAttributes(tagWriter);
    writeTagDetails(tagWriter);
    tagWriter.endTag();

    Object resolvedLabel = evaluate("label", getLabel());
    if (resolvedLabel != null) {
      tagWriter.startTag("label");
      tagWriter.writeAttribute("for", id);
      tagWriter.appendValue(convertToDisplayString(resolvedLabel));
      tagWriter.endTag();
    }

    return SKIP_BODY;
  }
Ejemplo n.º 2
0
  @Override
  protected int writeTagContent(TagWriter tagWriter) throws JspException {
    super.writeTagContent(tagWriter);

    if (!isDisabled()) {
      // Write out the 'field was present' marker.
      tagWriter.startTag("input");
      tagWriter.writeAttribute("type", "hidden");
      String name = WebDataBinder.DEFAULT_FIELD_MARKER_PREFIX + getName();
      tagWriter.writeAttribute("name", name);
      tagWriter.writeAttribute("value", processFieldValue(name, "on", getInputType()));
      tagWriter.endTag();
    }

    return SKIP_BODY;
  }