Overview | Package | Class | Tree | Deprecated | Index | Help
| Spring Framework
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## org.springframework.web.servlet.tags.form
Class LabelTag

    java.lang.Object
      javax.servlet.jsp.tagext.TagSupport
          org.springframework.web.servlet.tags.RequestContextAwareTag
              org.springframework.web.servlet.tags.HtmlEscapingAwareTag
                  org.springframework.web.servlet.tags.form.AbstractFormTag
                      org.springframework.web.servlet.tags.form.AbstractDataBoundFormElementTag
                          org.springframework.web.servlet.tags.form.AbstractHtmlElementTag
                              org.springframework.web.servlet.tags.form.LabelTag

All Implemented Interfaces:
  java.io.Serializable, javax.servlet.jsp.tagext.DynamicAttributes, javax.servlet.jsp.tagext.IterationTag, javax.servlet.jsp.tagext.JspTag, javax.servlet.jsp.tagext.Tag, javax.servlet.jsp.tagext.TryCatchFinally, EditorAwareTag

    public class LabelTag

extends AbstractHtmlElementTag

Databinding-aware JSP tag for rendering an HTML '`label`' element that defines text that is associated with a single form element.

The `'for'` attribute is required.

See the "formTags" showcase application that ships with the full Spring distribution for an example of this class in action.

Since:
  2.0
Author:
  Rob Harrop, Juergen Hoeller
See Also:
  Serialized Form

Field Summary

Fields inherited from class org.springframework.web.servlet.tags.form.AbstractHtmlElementTag
`CLASS_ATTRIBUTE, DIR_ATTRIBUTE, LANG_ATTRIBUTE, ONCLICK_ATTRIBUTE, ONDBLCLICK_ATTRIBUTE, ONKEYDOWN_ATTRIBUTE, ONKEYPRESS_ATTRIBUTE, ONKEYUP_ATTRIBUTE, ONMOUSEDOWN_ATTRIBUTE, ONMOUSEMOVE_ATTRIBUTE, ONMOUSEOUT_ATTRIBUTE, ONMOUSEOVER_ATTRIBUTE, ONMOUSEUP_ATTRIBUTE, STYLE_ATTRIBUTE, TABINDEX_ATTRIBUTE, TITLE_ATTRIBUTE`

Fields inherited from class org.springframework.web.servlet.tags.form.AbstractDataBoundFormElementTag
`COMMAND_NAME_VARIABLE_NAME, NESTED_PATH_VARIABLE_NAME`

Fields inherited from class org.springframework.web.servlet.tags.RequestContextAwareTag
`logger, REQUEST_CONTEXT_PAGE_ATTRIBUTE`

Fields inherited from class javax.servlet.jsp.tagext.TagSupport
`pageContext`

Fields inherited from interface javax.servlet.jsp.tagext.IterationTag
`EVAL_BODY_AGAIN`

Fields inherited from interface javax.servlet.jsp.tagext.Tag
`EVAL_BODY_INCLUDE, EVAL_PAGE, SKIP_BODY, SKIP_PAGE`

Constructor Summary
`LabelTag()`

Method Summary
`protected java.lang.String` | `autogenerateFor()` Autogenerate the '`for`' attribute value for this tag.
`int` | `doEndTag()` Close the '`label`' tag.
`void` | `doFinally()` Disposes of the `TagWriter` instance.
`java.lang.String` | `getFor()` Get the value of the '`id`' attribute.
`protected java.lang.String` | `getName()` Overrides `getName()` to always return `null`, because the '`name`' attribute is not supported by the '`label`' tag.
`protected java.lang.String` | `resolveFor()` Determine the '`for`' attribute value for this tag, autogenerating one if none specified.
`void` | `setFor(java.lang.String forId)` Set the value of the '`for`' attribute.
`protected int` | `writeTagContent(TagWriter tagWriter)` Writes the opening '`label`' tag and forces a block tag so that body content is written correctly.

Methods inherited from class org.springframework.web.servlet.tags.form.AbstractHtmlElementTag
`getCssClass, getCssErrorClass, getCssStyle, getDir, getDynamicAttributes, getLang, getOnclick, getOndblclick, getOnkeydown, getOnkeypress, getOnkeyup, getOnmousedown, getOnmousemove, getOnmouseout, getOnmouseover, getOnmouseup, getTabindex, getTitle, isValidDynamicAttribute, resolveCssClass, setCssClass, setCssErrorClass, setCssStyle, setDir, setDynamicAttribute, setLang, setOnclick, setOndblclick, setOnkeydown, setOnkeypress, setOnkeyup, setOnmousedown, setOnmousemove, setOnmouseout, setOnmouseover, setOnmouseup, setTabindex, setTitle, writeDefaultAttributes, writeOptionalAttributes`

Methods inherited from class org.springframework.web.servlet.tags.form.AbstractDataBoundFormElementTag
`autogenerateId, convertToDisplayString, getBindStatus, getBoundValue, getEditor, getId, getNestedPath, getPath, getPropertyEditor, getPropertyPath, processFieldValue, resolveId, setId, setPath`

Methods inherited from class org.springframework.web.servlet.tags.form.AbstractFormTag
`createTagWriter, doStartTagInternal, evaluate, evaluateBoolean, getDisplayString, getDisplayString, isDefaultHtmlEscape, writeOptionalAttribute`

Methods inherited from class org.springframework.web.servlet.tags.HtmlEscapingAwareTag
`isHtmlEscape, setHtmlEscape`

Methods inherited from class org.springframework.web.servlet.tags.RequestContextAwareTag
`doCatch, doStartTag, getRequestContext`

Methods inherited from class javax.servlet.jsp.tagext.TagSupport
`doAfterBody, findAncestorWithClass, getParent, getValue, getValues, release, removeValue, setPageContext, setParent, setValue`

Methods inherited from class java.lang.Object
`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

Constructor Detail

### LabelTag

    public LabelTag()

Method Detail

### setFor

    public void setFor(java.lang.String forId)

  Set the value of the '`for`' attribute.

  Defaults to the value of `AbstractDataBoundFormElementTag.getPath()`; may be a runtime expression.

  Throws:
    `java.lang.IllegalArgumentException` - if the supplied value is `null`

### getFor

    public java.lang.String getFor()

  Get the value of the '`id`' attribute.

  May be a runtime expression.

### writeTagContent

    protected int writeTagContent(TagWriter tagWriter)
                           throws javax.servlet.jsp.JspException

  Writes the opening '`label`' tag and forces a block tag so that body content is written correctly.

  Specified by:
    `writeTagContent` in class `AbstractFormTag`
  Returns:
    `Tag.EVAL_BODY_INCLUDE`
  Throws:
    `javax.servlet.jsp.JspException`

### getName

    protected java.lang.String getName()
                                throws javax.servlet.jsp.JspException

  Overrides `getName()` to always return `null`, because the '`name`' attribute is not supported by the '`label`' tag.

  Overrides:
    `getName` in class `AbstractDataBoundFormElementTag`
  Returns:
    the value for the HTML '`name`' attribute
  Throws:
    `javax.servlet.jsp.JspException`

### resolveFor

    protected java.lang.String resolveFor()
                                   throws javax.servlet.jsp.JspException

  Determine the '`for`' attribute value for this tag, autogenerating one if none specified.

  Throws:
    `javax.servlet.jsp.JspException`
  See Also:
    `getFor()`, `autogenerateFor()`

### autogenerateFor

    protected java.lang.String autogenerateFor()
                                        throws javax.servlet.jsp.JspException

  Autogenerate the '`for`' attribute value for this tag.

  The default implementation delegates to `AbstractDataBoundFormElementTag.getPropertyPath()`, deleting invalid characters (such as "[" or "]").

  Throws:
    `javax.servlet.jsp.JspException`

### doEndTag

    public int doEndTag()
                 throws javax.servlet.jsp.JspException

  Close the '`label`' tag.

  Specified by:
    `doEndTag` in interface `javax.servlet.jsp.tagext.Tag`
  Overrides:
    `doEndTag` in class `javax.servlet.jsp.tagext.TagSupport`
  Throws:
    `javax.servlet.jsp.JspException`

### doFinally

    public void doFinally()

  Disposes of the `TagWriter` instance.

  Specified by:
    `doFinally` in interface `javax.servlet.jsp.tagext.TryCatchFinally`
  Overrides:
    `doFinally` in class `AbstractDataBoundFormElementTag`

Overview | Package | Class | Tree | Deprecated | Index | Help
| Spring Framework
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD