Class AbstractDataBoundFormElementTag
java.lang.Object
jakarta.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
- All Implemented Interfaces:
jakarta.servlet.jsp.tagext.IterationTag, jakarta.servlet.jsp.tagext.JspTag, jakarta.servlet.jsp.tagext.Tag, jakarta.servlet.jsp.tagext.TryCatchFinally, Serializable, EditorAwareTag
- Direct Known Subclasses:
AbstractHtmlElementTag
public abstract class AbstractDataBoundFormElementTag
extends AbstractFormTag
implements EditorAwareTag
Base tag for all data-binding aware JSP form tags.
Provides the common path and id properties.
Provides subclasses with utility methods for accessing the BindStatus
of their bound value and also for interacting
with the TagWriter.
- Since:
- 2.0
- Author:
- Rob Harrop, Juergen Hoeller
- See Also:
-
Field Summary
FieldsModifier and TypeFieldDescriptionprotected static final StringName of the exposed path variable within the scope of this tag: "nestedPath".Fields inherited from class RequestContextAwareTag
logger, REQUEST_CONTEXT_PAGE_ATTRIBUTEFields inherited from class jakarta.servlet.jsp.tagext.TagSupport
pageContextFields inherited from interface jakarta.servlet.jsp.tagext.IterationTag
EVAL_BODY_AGAINFields inherited from interface jakarta.servlet.jsp.tagext.Tag
EVAL_BODY_INCLUDE, EVAL_PAGE, SKIP_BODY, SKIP_PAGE -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionAutogenerate the 'id' attribute value for this tag.protected StringGet a display String for the given value, converted by a PropertyEditor that the BindStatus may have registered for the value's Class.voidDisposes of theBindStatusinstance.protected BindStatusGet theBindStatusfor this tag.Get the bound value.final @Nullable PropertyEditorExposes thePropertyEditorforEditorAwareTag.getId()Get the value of the 'id' attribute.getName()Get the value for the HTML 'name' attribute.Get the value of the nested path that may have been exposed by theNestedPathTag.protected final StringgetPath()Get theresolvedproperty path for theform object.protected @Nullable PropertyEditorGet thePropertyEditor, if any, in use for value bound to this tag.protected StringBuild the property path for this tag, including the nested path but not prefixed with the name of the form attribute.protected final StringprocessFieldValue(@Nullable String name, String value, String type) Process the given form field through aRequestDataValueProcessorinstance if one is configured or otherwise returns the same value.Determine the 'id' attribute value for this tag, autogenerating one if none specified.voidSet the value of the 'id' attribute.voidSet the property path from theform object.protected voidwriteDefaultAttributes(TagWriter tagWriter) Writes the default set of attributes to the suppliedTagWriter.Methods inherited from class AbstractFormTag
createTagWriter, doStartTagInternal, evaluate, getDisplayString, getDisplayString, isDefaultHtmlEscape, writeOptionalAttribute, writeTagContentMethods inherited from class HtmlEscapingAwareTag
htmlEscape, isHtmlEscape, isResponseEncodedHtmlEscape, setHtmlEscapeMethods inherited from class RequestContextAwareTag
doCatch, doStartTag, getRequestContextMethods inherited from class jakarta.servlet.jsp.tagext.TagSupport
doAfterBody, doEndTag, findAncestorWithClass, getParent, getValue, getValues, release, removeValue, setPageContext, setParent, setValue
-
Field Details
-
NESTED_PATH_VARIABLE_NAME
Name of the exposed path variable within the scope of this tag: "nestedPath". Same value asNestedPathTag.NESTED_PATH_VARIABLE_NAME.- See Also:
-
-
Constructor Details
-
AbstractDataBoundFormElementTag
public AbstractDataBoundFormElementTag()
-
-
Method Details
-
setPath
Set the property path from theform object. May be a runtime expression. -
getPath
Get theresolvedproperty path for theform object.- Throws:
jakarta.servlet.jsp.JspException
-
setId
-
getId
-
writeDefaultAttributes
Writes the default set of attributes to the suppliedTagWriter. Further, abstract subclasses should override this method to add in any additional default attributes but must remember to call thesupermethod.Concrete subclasses should call this method when/if they want to render default attributes.
- Parameters:
tagWriter- theTagWriterto which any attributes are to be written- Throws:
jakarta.servlet.jsp.JspException
-
resolveId
-
autogenerateId
-
getName
Get the value for the HTML 'name' attribute.The default implementation simply delegates to
getPropertyPath()to use the property path as the name. For the most part this is desirable as it links with the server-side expectation for data binding. However, some subclasses may wish to change the value of the 'name' attribute without changing the bind path.- Returns:
- the value for the HTML '
name' attribute - Throws:
jakarta.servlet.jsp.JspException
-
getBindStatus
Get theBindStatusfor this tag.- Throws:
jakarta.servlet.jsp.JspException
-
getNestedPath
Get the value of the nested path that may have been exposed by theNestedPathTag. -
getPropertyPath
Build the property path for this tag, including the nested path but not prefixed with the name of the form attribute.- Throws:
jakarta.servlet.jsp.JspException- See Also:
-
getBoundValue
-
getPropertyEditor
Get thePropertyEditor, if any, in use for value bound to this tag.- Throws:
jakarta.servlet.jsp.JspException
-
getEditor
Exposes thePropertyEditorforEditorAwareTag.Use
getPropertyEditor()for internal rendering purposes.- Specified by:
getEditorin interfaceEditorAwareTag- Returns:
- the current PropertyEditor, or
nullif none - Throws:
jakarta.servlet.jsp.JspException- if resolving the editor failed
-
convertToDisplayString
-
processFieldValue
-
doFinally
public void doFinally()Disposes of theBindStatusinstance.- Specified by:
doFinallyin interfacejakarta.servlet.jsp.tagext.TryCatchFinally- Overrides:
doFinallyin classRequestContextAwareTag
-