类 AbstractFormTag
- 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.form.AbstractFormTag
- 所有已实现的接口:
Serializable
,IterationTag
,JspTag
,Tag
,TryCatchFinally
public abstract class AbstractFormTag extends HtmlEscapingAwareTag
Base class for all JSP form tags. Provides utility methods for null-safe EL evaluation and for accessing and working with aTagWriter
.Subclasses should implement the
writeTagContent(TagWriter)
to perform actual tag rendering.Subclasses (or test classes) can override the
createTagWriter()
method to redirect output to aWriter
other than theJspWriter
associated with the currentPageContext
.- 从以下版本开始:
- 2.0
- 作者:
- Rob Harrop, Juergen Hoeller
- 另请参阅:
- 序列化表格
字段概要
从类继承的字段 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
构造器概要
构造器 构造器 说明 AbstractFormTag()
方法概要
所有方法 实例方法 抽象方法 具体方法 修饰符和类型 方法 说明 protected TagWriter
createTagWriter()
Create theTagWriter
which all output will be written to.protected int
doStartTagInternal()
Provide a simple template method that callscreateTagWriter()
and passes the createdTagWriter
to thewriteTagContent(TagWriter)
method.protected Object
evaluate(String attributeName, Object value)
Evaluate the supplied value for the supplied attribute name.protected String
getDisplayString(Object value)
Get the display value of the suppliedObject
, HTML escaped as required.protected String
getDisplayString(Object value, PropertyEditor propertyEditor)
Get the display value of the suppliedObject
, HTML escaped as required.protected boolean
isDefaultHtmlEscape()
Overridden to default totrue
in case of no explicit default given.protected void
writeOptionalAttribute(TagWriter tagWriter, String attributeName, String value)
Optionally writes the supplied value under the supplied attribute name into the suppliedTagWriter
.protected abstract int
writeTagContent(TagWriter tagWriter)
Subclasses should implement this method to perform tag content rendering.从类继承的方法 org.springframework.web.servlet.tags.HtmlEscapingAwareTag
htmlEscape, isHtmlEscape, isResponseEncodedHtmlEscape, setHtmlEscape
从类继承的方法 org.springframework.web.servlet.tags.RequestContextAwareTag
doCatch, doFinally, doStartTag, getRequestContext
从类继承的方法 javax.servlet.jsp.tagext.TagSupport
doAfterBody, doEndTag, findAncestorWithClass, getId, getParent, getValue, getValues, release, removeValue, setId, setPageContext, setParent, setValue
构造器详细资料
AbstractFormTag
public AbstractFormTag()
方法详细资料
evaluate
@Nullable protected Object evaluate(String attributeName, @Nullable Object value) throws JspException
Evaluate the supplied value for the supplied attribute name.The default implementation simply returns the given value as-is.
- 抛出:
JspException
writeOptionalAttribute
protected final void writeOptionalAttribute(TagWriter tagWriter, String attributeName, @Nullable String value) throws JspException
Optionally writes the supplied value under the supplied attribute name into the suppliedTagWriter
. In this case, the supplied value isevaluated
first and then theString representation
is written as the attribute value. If the resultantString
representation isnull
or empty, no attribute is written.
createTagWriter
protected TagWriter createTagWriter()
Create theTagWriter
which all output will be written to. By default, theTagWriter
writes its output to theJspWriter
for the currentPageContext
. Subclasses may choose to change theWriter
to which output is actually written.
doStartTagInternal
protected final int doStartTagInternal() throws Exception
Provide a simple template method that callscreateTagWriter()
and passes the createdTagWriter
to thewriteTagContent(TagWriter)
method.- 指定者:
doStartTagInternal
在类中RequestContextAwareTag
- 返回:
- the value returned by
writeTagContent(TagWriter)
- 抛出:
Exception
- any exception, any checked one other than a JspException gets wrapped in a JspException by doStartTag- 另请参阅:
TagSupport.doStartTag()
getDisplayString
protected String getDisplayString(@Nullable Object value)
Get the display value of the suppliedObject
, HTML escaped as required. This version is notPropertyEditor
-aware.
getDisplayString
protected String getDisplayString(@Nullable Object value, @Nullable PropertyEditor propertyEditor)
Get the display value of the suppliedObject
, HTML escaped as required. If the supplied value is not aString
and the suppliedPropertyEditor
is not null then thePropertyEditor
is used to obtain the display value.
isDefaultHtmlEscape
protected boolean isDefaultHtmlEscape()
Overridden to default totrue
in case of no explicit default given.
writeTagContent
protected abstract int writeTagContent(TagWriter tagWriter) throws JspException
Subclasses should implement this method to perform tag content rendering.- 返回:
- valid tag render instruction as per
Tag.doStartTag()
. - 抛出:
JspException