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 AbstractFormTag

    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

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

Direct Known Subclasses:
  AbstractDataBoundFormElementTag

    public abstract class AbstractFormTag

extends HtmlEscapingAwareTag

Base class for all JSP form tags. Provides utility methods for null-safe EL evaluation and for accessing and working with a `TagWriter`.

Subclasses should implement the `writeTagContent(TagWriter)` to perform actual tag rendering.

Subclasses (or test classes) can override the `createTagWriter()` method to redirect output to a `Writer` other than the `JspWriter` associated with the current `PageContext`.

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

Field Summary

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

Fields inherited from class javax.servlet.jsp.tagext.TagSupport
`id, 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
`AbstractFormTag()`

Method Summary
`protected TagWriter` | `createTagWriter()` Create the `TagWriter` which all output will be written to.
`protected int` | `doStartTagInternal()` Provide a simple template method that calls `createTagWriter()` and passes the created `TagWriter` to the `writeTagContent(TagWriter)` method.
`protected java.lang.Object` | `evaluate(java.lang.String attributeName, java.lang.Object value)` Evaluate the supplied value for the supplied attribute name.
`protected boolean` | `evaluateBoolean(java.lang.String attributeName, java.lang.String value)` Evaluate the supplied value for the supplied attribute name.
`protected java.lang.String` | `getDisplayString(java.lang.Object value)` Get the display value of the supplied `Object`, HTML escaped as required.
`protected java.lang.String` | `getDisplayString(java.lang.Object value, java.beans.PropertyEditor propertyEditor)` Get the display value of the supplied `Object`, HTML escaped as required.
`protected boolean` | `isDefaultHtmlEscape()` Overridden to default to `true` in case of no explicit default given.
`protected void` | `writeOptionalAttribute(TagWriter tagWriter, java.lang.String attributeName, java.lang.String value)` Optionally writes the supplied value under the supplied attribute name into the supplied `TagWriter`.
`protected abstract int` | `writeTagContent(TagWriter tagWriter)` Subclasses should implement this method to perform tag content rendering.

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

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

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

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

Constructor Detail

### AbstractFormTag

    public AbstractFormTag()

Method Detail

### evaluate

    protected java.lang.Object evaluate(java.lang.String attributeName,
                                        java.lang.Object value)
                                 throws javax.servlet.jsp.JspException

  Evaluate the supplied value for the supplied attribute name. If the supplied value is `null` then `null` is returned, otherwise evaluation is handled using `ExpressionEvaluationUtils.evaluate(String, String, javax.servlet.jsp.PageContext)`.

  Throws:
    `javax.servlet.jsp.JspException`

### evaluateBoolean

    protected boolean evaluateBoolean(java.lang.String attributeName,
                                      java.lang.String value)
                               throws javax.servlet.jsp.JspException

  Evaluate the supplied value for the supplied attribute name. If the supplied value is `null` then `false` is returned, otherwise evaluation is handled using `ExpressionEvaluationUtils.evaluate(String, String, javax.servlet.jsp.PageContext)`, with subsequent matching against `Boolean.TRUE` and `Boolean.valueOf`.

  Throws:
    `javax.servlet.jsp.JspException`

### writeOptionalAttribute

    protected final void writeOptionalAttribute(TagWriter tagWriter,
                                                java.lang.String attributeName,
                                                java.lang.String value)
                                         throws javax.servlet.jsp.JspException

  Optionally writes the supplied value under the supplied attribute name into the supplied `TagWriter`. In this case, the supplied value is `evaluated` first and then the `String representation` is written as the attribute value. If the resultant `String` representation is `null` or empty, no attribute is written.

  Throws:
    `javax.servlet.jsp.JspException`
  See Also:
    `TagWriter.writeOptionalAttributeValue(String, String)`

### createTagWriter

    protected TagWriter createTagWriter()

  Create the `TagWriter` which all output will be written to. By default, the `TagWriter` writes its output to the `JspWriter` for the current `PageContext`. Subclasses may choose to change the `Writer` to which output is actually written.

### doStartTagInternal

    protected final int doStartTagInternal()
                                    throws java.lang.Exception

  Provide a simple template method that calls `createTagWriter()` and passes the created `TagWriter` to the `writeTagContent(TagWriter)` method.

  Specified by:
    `doStartTagInternal` in class `RequestContextAwareTag`
  Returns:
    the value returned by `writeTagContent(TagWriter)`
  Throws:
    `java.lang.Exception` - any exception, any checked one other than a JspException gets wrapped in a JspException by doStartTag
  See Also:
    `TagSupport.doStartTag()`

### getDisplayString

    protected java.lang.String getDisplayString(java.lang.Object value)

  Get the display value of the supplied `Object`, HTML escaped as required. This version is not `PropertyEditor`-aware.

### getDisplayString

    protected java.lang.String getDisplayString(java.lang.Object value,
                                                java.beans.PropertyEditor propertyEditor)

  Get the display value of the supplied `Object`, HTML escaped as required. If the supplied value is not a `String` and the supplied `PropertyEditor` is not null then the `PropertyEditor` is used to obtain the display value.

### isDefaultHtmlEscape

    protected boolean isDefaultHtmlEscape()

  Overridden to default to `true` in case of no explicit default given.

  Overrides:
    `isDefaultHtmlEscape` in class `HtmlEscapingAwareTag`
  See Also:
    `RequestContextAwareTag.getRequestContext()`

### writeTagContent

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

  Subclasses should implement this method to perform tag content rendering.

  Returns:
    valid tag render instruction as per `Tag.doStartTag()`.
  Throws:
    `javax.servlet.jsp.JspException`

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