public abstract class AbstractFormTag extends HtmlEscapingAwareTag
TagWriter
.
Subclasses should implement the writeTagContent(TagWriter)
to perform
actual tag rendering.
Subclasses (or test classes) can override the createTagWriter()
method to
redirect output to a Writer
other than the JspWriter
associated with the current PageContext
.
logger, REQUEST_CONTEXT_PAGE_ATTRIBUTE
id, pageContext
EVAL_BODY_AGAIN
EVAL_BODY_INCLUDE, EVAL_PAGE, SKIP_BODY, SKIP_PAGE
Constructor and Description |
---|
AbstractFormTag() |
Modifier and Type | Method and Description |
---|---|
protected TagWriter |
createTagWriter()
Create the
TagWriter which all output will be written to. |
protected int |
doStartTagInternal()
Provide a simple template method that calls
createTagWriter() and passes
the created TagWriter to the writeTagContent(TagWriter) method. |
protected Object |
evaluate(String attributeName,
Object value)
Evaluate the supplied value for the supplied attribute name.
|
protected boolean |
evaluateBoolean(String attributeName,
String value)
Evaluate the supplied value for the supplied attribute name.
|
protected String |
getDisplayString(Object value)
Get the display value of the supplied
Object , HTML escaped
as required. |
protected String |
getDisplayString(Object value,
PropertyEditor propertyEditor)
Get the display value of the supplied
Object , HTML escaped
as required. |
protected boolean |
isDefaultHtmlEscape()
Overridden to default to
true 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 supplied
TagWriter . |
protected abstract int |
writeTagContent(TagWriter tagWriter)
Subclasses should implement this method to perform tag content rendering.
|
isHtmlEscape, setHtmlEscape
doCatch, doFinally, doStartTag, getRequestContext
doAfterBody, doEndTag, findAncestorWithClass, getId, getParent, getValue, getValues, release, removeValue, setId, setPageContext, setParent, setValue
protected Object evaluate(String attributeName, Object value) throws JspException
null
then null
is returned, otherwise evaluation is
handled using ExpressionEvaluationUtils.evaluate(String, String, javax.servlet.jsp.PageContext)
.JspException
protected boolean evaluateBoolean(String attributeName, String value) throws JspException
null
then false
is returned, otherwise evaluation is
handled using ExpressionEvaluationUtils.evaluate(String, String, javax.servlet.jsp.PageContext)
,
with subsequent matching against Boolean.TRUE
and Boolean.valueOf
.JspException
protected final void writeOptionalAttribute(TagWriter tagWriter, String attributeName, String value) throws JspException
TagWriter
. In this case, the supplied value is evaluated
first
and then the String representation
is written as the
attribute value. If the resultant String
representation is null
or empty, no attribute is written.JspException
TagWriter.writeOptionalAttributeValue(String, String)
protected TagWriter createTagWriter()
TagWriter
which all output will be written to. By default,
the TagWriter
writes its output to the JspWriter
for the current PageContext
. Subclasses may choose to
change the Writer
to which output is actually written.protected final int doStartTagInternal() throws Exception
createTagWriter()
and passes
the created TagWriter
to the writeTagContent(TagWriter)
method.doStartTagInternal
in class RequestContextAwareTag
writeTagContent(TagWriter)
Exception
- any exception, any checked one other than
a JspException gets wrapped in a JspException by doStartTagTagSupport.doStartTag()
protected String getDisplayString(Object value)
Object
, HTML escaped
as required. This version is not PropertyEditor
-aware.protected String getDisplayString(Object value, PropertyEditor propertyEditor)
Object
, HTML escaped
as required. If the supplied value is not a String
and the supplied
PropertyEditor
is not null then the PropertyEditor
is used
to obtain the display value.protected boolean isDefaultHtmlEscape()
true
in case of no explicit default given.isDefaultHtmlEscape
in class HtmlEscapingAwareTag
RequestContextAwareTag.getRequestContext()
protected abstract int writeTagContent(TagWriter tagWriter) throws JspException
Tag.doStartTag()
.JspException