public abstract class AbstractDataBoundFormElementTag extends AbstractFormTag implements EditorAwareTag
Provides the common path
and id
properties.
Provides sub-classes with utility methods for accessing the BindStatus
of their bound value and also for interacting
with the TagWriter
.
Modifier and Type | Field and Description |
---|---|
protected static String |
NESTED_PATH_VARIABLE_NAME
Name of the exposed path variable within the scope of this tag: "nestedPath".
|
logger, REQUEST_CONTEXT_PAGE_ATTRIBUTE
pageContext
EVAL_BODY_AGAIN
EVAL_BODY_INCLUDE, EVAL_PAGE, SKIP_BODY, SKIP_PAGE
Constructor and Description |
---|
AbstractDataBoundFormElementTag() |
Modifier and Type | Method and Description |
---|---|
protected String |
autogenerateId()
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 |
doFinally()
Disposes of the
BindStatus instance. |
protected BindStatus |
getBindStatus()
Get the
BindStatus for this tag. |
protected Object |
getBoundValue()
Get the bound value.
|
PropertyEditor |
getEditor()
Exposes the
PropertyEditor for EditorAwareTag . |
String |
getId()
Get the value of the '
id ' attribute. |
protected String |
getName()
Get the value for the HTML '
name ' attribute. |
protected String |
getNestedPath()
Get the value of the nested path that may have been exposed by the
NestedPathTag . |
protected String |
getPath()
Get the
resolved property path for the
form object . |
protected PropertyEditor |
getPropertyEditor()
Get the
PropertyEditor , if any, in use for value bound to this tag. |
protected String |
getPropertyPath()
Build the property path for this tag, including the nested path
but not prefixed with the name of the form attribute.
|
protected String |
processFieldValue(String name,
String value,
String type)
Process the given form field through a
RequestDataValueProcessor
instance if one is configured or otherwise returns the same value. |
protected String |
resolveId()
Determine the '
id ' attribute value for this tag,
autogenerating one if none specified. |
void |
setId(String id)
Set the value of the '
id ' attribute. |
void |
setPath(String path)
Set the property path from the
form object . |
protected void |
writeDefaultAttributes(TagWriter tagWriter)
Writes the default set of attributes to the supplied
TagWriter . |
createTagWriter, doStartTagInternal, evaluate, getDisplayString, getDisplayString, isDefaultHtmlEscape, writeOptionalAttribute, writeTagContent
htmlEscape, isHtmlEscape, isResponseEncodedHtmlEscape, setHtmlEscape
doCatch, doStartTag, getRequestContext
doAfterBody, doEndTag, findAncestorWithClass, getParent, getValue, getValues, release, removeValue, setPageContext, setParent, setValue
protected static final String NESTED_PATH_VARIABLE_NAME
NestedPathTag.NESTED_PATH_VARIABLE_NAME
.public void setPath(String path)
form object
.
May be a runtime expression.protected final String getPath() throws JspException
resolved
property path for the
form object
.JspException
public void setId(@Nullable String id)
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.
setId
in class TagSupport
@Nullable public String getId()
id
' attribute.getId
in class TagSupport
protected void writeDefaultAttributes(TagWriter tagWriter) throws JspException
TagWriter
.
Further abstract sub-classes should override this method to add in
any additional default attributes but must remember
to call the super
method.
Concrete sub-classes should call this method when/if they want to render default attributes.
tagWriter
- the TagWriter
to which any attributes are to be writtenJspException
@Nullable protected String resolveId() throws JspException
id
' attribute value for this tag,
autogenerating one if none specified.JspException
getId()
,
autogenerateId()
@Nullable protected String autogenerateId() throws JspException
id
' attribute value for this tag.
The default implementation simply delegates to getName()
,
deleting invalid characters (such as "[" or "]").
JspException
@Nullable protected String getName() throws JspException
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.
name
' attributeJspException
protected BindStatus getBindStatus() throws JspException
BindStatus
for this tag.JspException
@Nullable protected String getNestedPath()
NestedPathTag
.protected String getPropertyPath() throws JspException
JspException
getNestedPath()
,
getPath()
@Nullable protected final Object getBoundValue() throws JspException
JspException
getBindStatus()
@Nullable protected PropertyEditor getPropertyEditor() throws JspException
PropertyEditor
, if any, in use for value bound to this tag.JspException
@Nullable public final PropertyEditor getEditor() throws JspException
PropertyEditor
for EditorAwareTag
.
Use getPropertyEditor()
for internal rendering purposes.
getEditor
in interface EditorAwareTag
null
if noneJspException
- if resolving the editor failedprotected String convertToDisplayString(@Nullable Object value) throws JspException
JspException
protected final String processFieldValue(@Nullable String name, String value, String type)
RequestDataValueProcessor
instance if one is configured or otherwise returns the same value.public void doFinally()
BindStatus
instance.doFinally
in interface TryCatchFinally
doFinally
in class RequestContextAwareTag