Class BindTag
- All Implemented Interfaces:
IterationTag,JspTag,Tag,TryCatchFinally,Serializable,EditorAwareTag
<bind> tag supports evaluation of binding errors for a certain
bean or bean property. Exposes a "status" variable of type
BindStatus,
to both Java expressions and JSP EL expressions.
Can be used to bind to any bean or bean property in the model. The specified path determines whether the tag exposes the status of the bean itself (showing object-level errors), a specific bean property (showing field errors), or a matching set of bean properties (showing all corresponding field errors).
The Errors object that has
been bound using this tag is exposed to collaborating tags, as well
as the bean property that this errors object applies to. Nested tags
such as the TransformTag can access those exposed properties.
| Attribute | Required? | Runtime Expression? | Description |
|---|---|---|---|
htmlEscape |
false |
true |
Set HTML escaping for this tag, as boolean value. Overrides the default HTML escaping setting for the current page. |
ignoreNestedPath |
false |
true |
Set whether to ignore a nested path, if any. Default is to not ignore. |
path |
true |
true |
The path to the bean or bean property to bind status information for. For instance account.name, company.address.zipCode or just employee. The status object will exported to the page scope, specifically for this bean or bean property |
- Author:
- Rod Johnson, Juergen Hoeller
- See Also:
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final StringName of the exposed variable within the scope of this tag: "status".Fields inherited from class org.springframework.web.servlet.tags.RequestContextAwareTag
logger, REQUEST_CONTEXT_PAGE_ATTRIBUTEFields inherited from class jakarta.servlet.jsp.tagext.TagSupport
id, 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 TypeMethodDescriptionintdoEndTag()voidprotected final intCalled by doStartTag to perform the actual work.final PropertyEditorRetrieve the PropertyEditor for the property that this tag is currently bound to.final ErrorsRetrieve the Errors instance that this tag is currently bound to.getPath()Return the path that this tag applies to.final StringRetrieve the property that this tag is currently bound to, ornullif bound to an object rather than a specific property.booleanReturn whether to ignore a nested path, if any.voidsetIgnoreNestedPath(boolean ignoreNestedPath) Set whether to ignore a nested path, if any.voidSet the path that this tag should apply.Methods inherited from class org.springframework.web.servlet.tags.HtmlEscapingAwareTag
htmlEscape, isDefaultHtmlEscape, isHtmlEscape, isResponseEncodedHtmlEscape, setHtmlEscapeMethods inherited from class org.springframework.web.servlet.tags.RequestContextAwareTag
doCatch, doStartTag, getRequestContextMethods inherited from class jakarta.servlet.jsp.tagext.TagSupport
doAfterBody, findAncestorWithClass, getId, getParent, getValue, getValues, release, removeValue, setId, setPageContext, setParent, setValue
-
Field Details
-
STATUS_VARIABLE_NAME
Name of the exposed variable within the scope of this tag: "status".- See Also:
-
-
Constructor Details
-
BindTag
public BindTag()
-
-
Method Details
-
setPath
Set the path that this tag should apply. Can be a bean (e.g. "person") to get global errors, or a bean property (e.g. "person.name") to get field errors (also supporting nested fields and "person.na*" mappings). "person.*" will return all errors for the specified bean, both global and field errors. -
getPath
Return the path that this tag applies to. -
setIgnoreNestedPath
public void setIgnoreNestedPath(boolean ignoreNestedPath) Set whether to ignore a nested path, if any. Default is to not ignore. -
isIgnoreNestedPath
public boolean isIgnoreNestedPath()Return whether to ignore a nested path, if any. -
doStartTagInternal
Description copied from class:RequestContextAwareTagCalled by doStartTag to perform the actual work.- Specified by:
doStartTagInternalin classRequestContextAwareTag- Returns:
- same as TagSupport.doStartTag
- Throws:
Exception- any exception, any checked one other than a JspException gets wrapped in a JspException by doStartTag- See Also:
-
doEndTag
public int doEndTag()- Specified by:
doEndTagin interfaceTag- Overrides:
doEndTagin classTagSupport
-
getProperty
Retrieve the property that this tag is currently bound to, ornullif bound to an object rather than a specific property. Intended for cooperating nesting tags.- Returns:
- the property that this tag is currently bound to,
or
nullif none
-
getErrors
Retrieve the Errors instance that this tag is currently bound to. Intended for cooperating nesting tags.- Returns:
- the current Errors instance, or
nullif none
-
getEditor
Description copied from interface:EditorAwareTagRetrieve the PropertyEditor for the property that this tag is currently bound to. Intended for cooperating nesting tags.- Specified by:
getEditorin interfaceEditorAwareTag- Returns:
- the current PropertyEditor, or
nullif none
-
doFinally
public void doFinally()- Specified by:
doFinallyin interfaceTryCatchFinally- Overrides:
doFinallyin classRequestContextAwareTag
-