类 BindTag
- 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.BindTag
- 所有已实现的接口:
Serializable
,IterationTag
,JspTag
,Tag
,TryCatchFinally
,EditorAwareTag
public class BindTag extends HtmlEscapingAwareTag implements EditorAwareTag
The<bind>
tag supports evaluation of binding errors for a certain bean or bean property. Exposes a "status" variable of typeBindStatus
, 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 theTransformTag
can access those exposed properties.Attribute Summary 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
- 作者:
- Rod Johnson, Juergen Hoeller
- 另请参阅:
setPath(java.lang.String)
, 序列化表格
字段概要
字段 修饰符和类型 字段 说明 static String
STATUS_VARIABLE_NAME
Name of the exposed variable within the scope of this tag: "status".从类继承的字段 org.springframework.web.servlet.tags.RequestContextAwareTag
logger, REQUEST_CONTEXT_PAGE_ATTRIBUTE
从类继承的字段 javax.servlet.jsp.tagext.TagSupport
id, pageContext
从接口继承的字段 javax.servlet.jsp.tagext.IterationTag
EVAL_BODY_AGAIN
从接口继承的字段 javax.servlet.jsp.tagext.Tag
EVAL_BODY_INCLUDE, EVAL_PAGE, SKIP_BODY, SKIP_PAGE
构造器概要
构造器 构造器 说明 BindTag()
方法概要
所有方法 实例方法 具体方法 修饰符和类型 方法 说明 int
doEndTag()
void
doFinally()
protected int
doStartTagInternal()
Called by doStartTag to perform the actual work.PropertyEditor
getEditor()
Retrieve the PropertyEditor for the property that this tag is currently bound to.Errors
getErrors()
Retrieve the Errors instance that this tag is currently bound to.String
getPath()
Return the path that this tag applies to.String
getProperty()
Retrieve the property that this tag is currently bound to, ornull
if bound to an object rather than a specific property.boolean
isIgnoreNestedPath()
Return whether to ignore a nested path, if any.void
setIgnoreNestedPath(boolean ignoreNestedPath)
Set whether to ignore a nested path, if any.void
setPath(String path)
Set the path that this tag should apply.从类继承的方法 org.springframework.web.servlet.tags.HtmlEscapingAwareTag
htmlEscape, isDefaultHtmlEscape, isHtmlEscape, isResponseEncodedHtmlEscape, setHtmlEscape
从类继承的方法 org.springframework.web.servlet.tags.RequestContextAwareTag
doCatch, doStartTag, getRequestContext
从类继承的方法 javax.servlet.jsp.tagext.TagSupport
doAfterBody, findAncestorWithClass, getId, getParent, getValue, getValues, release, removeValue, setId, setPageContext, setParent, setValue
字段详细资料
STATUS_VARIABLE_NAME
public static final String STATUS_VARIABLE_NAME
Name of the exposed variable within the scope of this tag: "status".- 另请参阅:
- 常量字段值
构造器详细资料
BindTag
public BindTag()
方法详细资料
setPath
public void setPath(String path)
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.
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
protected final int doStartTagInternal() throws Exception
从类复制的说明:RequestContextAwareTag
Called by doStartTag to perform the actual work.- 指定者:
doStartTagInternal
在类中RequestContextAwareTag
- 返回:
- same as TagSupport.doStartTag
- 抛出:
Exception
- any exception, any checked one other than a JspException gets wrapped in a JspException by doStartTag- 另请参阅:
TagSupport.doStartTag()
doEndTag
public int doEndTag()
- 指定者:
doEndTag
在接口中Tag
- 覆盖:
doEndTag
在类中TagSupport
getProperty
@Nullable public final String getProperty()
Retrieve the property that this tag is currently bound to, ornull
if bound to an object rather than a specific property. Intended for cooperating nesting tags.- 返回:
- the property that this tag is currently bound to, or
null
if none
getErrors
@Nullable public final Errors getErrors()
Retrieve the Errors instance that this tag is currently bound to. Intended for cooperating nesting tags.- 返回:
- the current Errors instance, or
null
if none
getEditor
@Nullable public final PropertyEditor getEditor()
从接口复制的说明:EditorAwareTag
Retrieve the PropertyEditor for the property that this tag is currently bound to. Intended for cooperating nesting tags.- 指定者:
getEditor
在接口中EditorAwareTag
- 返回:
- the current PropertyEditor, or
null
if none
doFinally
public void doFinally()
- 指定者:
doFinally
在接口中TryCatchFinally
- 覆盖:
doFinally
在类中RequestContextAwareTag