public class ErrorsTag extends AbstractHtmlElementBodyTag implements BodyTag
<errors> tag renders field errors in an HTML 'span' tag.
Displays errors for either an object or a particular field.
This tag supports three main usage patterns:
path' to the field name (or path)path'path' to '*'
| Attribute | Required? | Runtime Expression? | Description |
|---|---|---|---|
cssClass |
false |
true |
HTML Optional Attribute |
cssStyle |
false |
true |
HTML Optional Attribute |
delimiter |
false |
true |
Delimiter for displaying multiple error messages. Defaults to the br tag. |
dir |
false |
true |
HTML Standard Attribute |
element |
false |
true |
Specifies the HTML element that is used to render the enclosing errors. |
htmlEscape |
false |
true |
Enable/disable HTML escaping of rendered values. |
id |
false |
true |
HTML Standard Attribute |
lang |
false |
true |
HTML Standard Attribute |
onclick |
false |
true |
HTML Event Attribute |
ondblclick |
false |
true |
HTML Event Attribute |
onkeydown |
false |
true |
HTML Event Attribute |
onkeypress |
false |
true |
HTML Event Attribute |
onkeyup |
false |
true |
HTML Event Attribute |
onmousedown |
false |
true |
HTML Event Attribute |
onmousemove |
false |
true |
HTML Event Attribute |
onmouseout |
false |
true |
HTML Event Attribute |
onmouseover |
false |
true |
HTML Event Attribute |
onmouseup |
false |
true |
HTML Event Attribute |
path |
false |
true |
Path to errors object for data binding |
tabindex |
false |
true |
HTML Standard Attribute |
title |
false |
true |
HTML Standard Attribute |
| Modifier and Type | Field and Description |
|---|---|
static java.lang.String |
MESSAGES_ATTRIBUTE
The key under which this tag exposes error messages in
the
page context scope. |
static java.lang.String |
SPAN_TAG
The HTML '
span' tag. |
CLASS_ATTRIBUTE, DIR_ATTRIBUTE, LANG_ATTRIBUTE, ONCLICK_ATTRIBUTE, ONDBLCLICK_ATTRIBUTE, ONKEYDOWN_ATTRIBUTE, ONKEYPRESS_ATTRIBUTE, ONKEYUP_ATTRIBUTE, ONMOUSEDOWN_ATTRIBUTE, ONMOUSEMOVE_ATTRIBUTE, ONMOUSEOUT_ATTRIBUTE, ONMOUSEOVER_ATTRIBUTE, ONMOUSEUP_ATTRIBUTE, STYLE_ATTRIBUTE, TABINDEX_ATTRIBUTE, TITLE_ATTRIBUTENESTED_PATH_VARIABLE_NAMElogger, REQUEST_CONTEXT_PAGE_ATTRIBUTEpageContextEVAL_BODY_BUFFERED, EVAL_BODY_TAGEVAL_BODY_AGAINEVAL_BODY_INCLUDE, EVAL_PAGE, SKIP_BODY, SKIP_PAGE| Constructor and Description |
|---|
ErrorsTag() |
| Modifier and Type | Method and Description |
|---|---|
protected java.lang.String |
autogenerateId()
Get the value for the HTML '
id' attribute. |
protected void |
exposeAttributes()
Exposes any bind status error messages under
this key
in the PageContext.PAGE_SCOPE. |
java.lang.String |
getDelimiter()
Return the delimiter to be used between error messages.
|
java.lang.String |
getElement()
Get the HTML element must be used to render the error messages.
|
protected java.lang.String |
getName()
Get the value for the HTML '
name' attribute. |
protected void |
removeAttributes()
Removes any bind status error messages that were previously stored under
this key in the PageContext.PAGE_SCOPE. |
protected void |
renderDefaultContent(TagWriter tagWriter) |
void |
setDelimiter(java.lang.String delimiter)
Set the delimiter to be used between error messages.
|
void |
setElement(java.lang.String element)
Set the HTML element must be used to render the error messages.
|
protected boolean |
shouldRender()
Should rendering of this tag proceed at all?
|
doEndTag, doFinally, doInitBody, flushBufferedBodyContent, onWriteTagContent, renderFromBodyContent, setBodyContent, writeTagContentgetCssClass, getCssErrorClass, getCssStyle, getDir, getDynamicAttributes, getLang, getOnclick, getOndblclick, getOnkeydown, getOnkeypress, getOnkeyup, getOnmousedown, getOnmousemove, getOnmouseout, getOnmouseover, getOnmouseup, getTabindex, getTitle, isValidDynamicAttribute, resolveCssClass, setCssClass, setCssErrorClass, setCssStyle, setDir, setDynamicAttribute, setLang, setOnclick, setOndblclick, setOnkeydown, setOnkeypress, setOnkeyup, setOnmousedown, setOnmousemove, setOnmouseout, setOnmouseover, setOnmouseup, setTabindex, setTitle, writeDefaultAttributes, writeOptionalAttributesconvertToDisplayString, getBindStatus, getBoundValue, getEditor, getId, getNestedPath, getPath, getPropertyEditor, getPropertyPath, processFieldValue, resolveId, setId, setPathcreateTagWriter, doStartTagInternal, evaluate, getDisplayString, getDisplayString, isDefaultHtmlEscape, writeOptionalAttributehtmlEscape, isHtmlEscape, isResponseEncodedHtmlEscape, setHtmlEscapedoCatch, doStartTag, getRequestContextdoAfterBody, findAncestorWithClass, getParent, getValue, getValues, release, removeValue, setPageContext, setParent, setValueclone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitdoInitBody, setBodyContentdoAfterBodydoEndTag, doStartTag, getParent, release, setPageContext, setParentpublic static final java.lang.String MESSAGES_ATTRIBUTE
page context scope.public static final java.lang.String SPAN_TAG
span' tag.public void setElement(java.lang.String element)
Defaults to an HTML '<span/>' tag.
public java.lang.String getElement()
public void setDelimiter(java.lang.String delimiter)
Defaults to an HTML '<br/>' tag.
public java.lang.String getDelimiter()
protected java.lang.String autogenerateId()
throws JspException
id' attribute.
Appends '.errors' to the value returned by AbstractDataBoundFormElementTag.getPropertyPath()
or to the model attribute name if the <form:errors/> tag's
'path' attribute has been omitted.
autogenerateId in class AbstractDataBoundFormElementTagid' attributeJspExceptionAbstractDataBoundFormElementTag.getPropertyPath()protected java.lang.String getName()
throws JspException
name' attribute.
Simply returns null because the 'name' attribute
is not a validate attribute for the 'span' element.
getName in class AbstractDataBoundFormElementTagname' attributeJspExceptionprotected boolean shouldRender()
throws JspException
Only renders output when there are errors for the configured path.
shouldRender in class AbstractHtmlElementBodyTagtrue only when there are errors for the configured pathJspExceptionprotected void renderDefaultContent(TagWriter tagWriter) throws JspException
renderDefaultContent in class AbstractHtmlElementBodyTagJspExceptionprotected void exposeAttributes()
throws JspException
this key
in the PageContext.PAGE_SCOPE.
Only called if shouldRender() returns true.
exposeAttributes in class AbstractHtmlElementBodyTagJspExceptionremoveAttributes()protected void removeAttributes()
this key in the PageContext.PAGE_SCOPE.removeAttributes in class AbstractHtmlElementBodyTagexposeAttributes()