Class AbstractDataBoundFormElementTag
- All Implemented Interfaces:
IterationTag
,JspTag
,Tag
,TryCatchFinally
,Serializable
,EditorAwareTag
- Direct Known Subclasses:
AbstractHtmlElementTag
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
Modifier and TypeFieldDescriptionprotected static final String
Name of the exposed path variable within the scope of this tag: "nestedPath".Fields inherited from class org.springframework.web.servlet.tags.RequestContextAwareTag
logger, REQUEST_CONTEXT_PAGE_ATTRIBUTE
Fields inherited from class jakarta.servlet.jsp.tagext.TagSupport
pageContext
Fields inherited from interface jakarta.servlet.jsp.tagext.IterationTag
EVAL_BODY_AGAIN
Fields inherited from interface jakarta.servlet.jsp.tagext.Tag
EVAL_BODY_INCLUDE, EVAL_PAGE, SKIP_BODY, SKIP_PAGE
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionprotected String
Autogenerate the 'id
' attribute value for this tag.protected String
convertToDisplayString
(Object value) Get a display String for the given value, converted by a PropertyEditor that the BindStatus may have registered for the value's Class.void
Disposes of theBindStatus
instance.protected BindStatus
Get theBindStatus
for this tag.protected final Object
Get the bound value.final PropertyEditor
Exposes thePropertyEditor
forEditorAwareTag
.getId()
Get the value of the 'id
' attribute.protected String
getName()
Get the value for the HTML 'name
' attribute.protected String
Get the value of the nested path that may have been exposed by theNestedPathTag
.protected final String
getPath()
Get theresolved
property path for theform object
.protected PropertyEditor
Get thePropertyEditor
, if any, in use for value bound to this tag.protected String
Build the property path for this tag, including the nested path but not prefixed with the name of the form attribute.protected final String
processFieldValue
(String name, String value, String type) Process the given form field through aRequestDataValueProcessor
instance if one is configured or otherwise returns the same value.protected String
Determine the 'id
' attribute value for this tag, autogenerating one if none specified.void
Set the value of the 'id
' attribute.void
Set the property path from theform object
.protected void
writeDefaultAttributes
(TagWriter tagWriter) Writes the default set of attributes to the suppliedTagWriter
.Methods inherited from class org.springframework.web.servlet.tags.form.AbstractFormTag
createTagWriter, doStartTagInternal, evaluate, getDisplayString, getDisplayString, isDefaultHtmlEscape, writeOptionalAttribute, writeTagContent
Methods inherited from class org.springframework.web.servlet.tags.HtmlEscapingAwareTag
htmlEscape, isHtmlEscape, isResponseEncodedHtmlEscape, setHtmlEscape
Methods inherited from class org.springframework.web.servlet.tags.RequestContextAwareTag
doCatch, doStartTag, getRequestContext
Methods 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 theresolved
property path for theform object
.- Throws:
JspException
-
setId
Set the value of the 'id
' attribute.May be a runtime expression; defaults to the value of
getName()
. Note that the default value may not be valid for certain tags.- Overrides:
setId
in classTagSupport
-
getId
Get the value of the 'id
' attribute.- Overrides:
getId
in classTagSupport
-
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 thesuper
method.Concrete subclasses should call this method when/if they want to render default attributes.
- Parameters:
tagWriter
- theTagWriter
to which any attributes are to be written- Throws:
JspException
-
resolveId
Determine the 'id
' attribute value for this tag, autogenerating one if none specified.- Throws:
JspException
- See Also:
-
autogenerateId
Autogenerate the 'id
' attribute value for this tag.The default implementation simply delegates to
getName()
, deleting invalid characters (such as "[" or "]").- Throws:
JspException
-
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:
JspException
-
getBindStatus
Get theBindStatus
for this tag.- Throws:
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:
JspException
- See Also:
-
getBoundValue
Get the bound value.- Throws:
JspException
- See Also:
-
getPropertyEditor
Get thePropertyEditor
, if any, in use for value bound to this tag.- Throws:
JspException
-
getEditor
Exposes thePropertyEditor
forEditorAwareTag
.Use
getPropertyEditor()
for internal rendering purposes.- Specified by:
getEditor
in interfaceEditorAwareTag
- Returns:
- the current PropertyEditor, or
null
if none - Throws:
JspException
- if resolving the editor failed
-
convertToDisplayString
Get a display String for the given value, converted by a PropertyEditor that the BindStatus may have registered for the value's Class.- Throws:
JspException
-
processFieldValue
Process the given form field through aRequestDataValueProcessor
instance if one is configured or otherwise returns the same value. -
doFinally
public void doFinally()Disposes of theBindStatus
instance.- Specified by:
doFinally
in interfaceTryCatchFinally
- Overrides:
doFinally
in classRequestContextAwareTag
-