public class InputLabelTag extends InputTagSupport implements BodyTag
Tag handler for a tag that produces an HTML label tag which is capable of looking up
localized field names and formatting the label when validation errors exist. The field being
labeled is identified using either the name attribute (preferred) or the
for attribute. If the name attribute is supplied this will always be used as
the lookup key (optionally pre-pended with the form's action path). If the name field
is not supplied, the tag will fall back to using the value supplied for the for
attribute. This is done because the for attribute is used by HTML as a reference to the
id of the input being labeled. In the case where the id is equal to the field name
it is unnecessary to specify a name attribute for the label tag. In cases where the
field name (or other localized resource name) does not match an HTML ID, the name
attribute must be used.
The value used for the label is the localized field name if one exists. Localized field
names are looked up in the field name resource bundle first using formActionPath.fieldName,
and then (if no value is found) using just fieldName. If no localized String can be found
then the body of the label tag is used. If no body is supplied then a warning String will be used
instead!
errorRenderer, fieldErrorspageContext, parentTagEVAL_BODY_BUFFERED, EVAL_BODY_TAGEVAL_BODY_AGAINEVAL_BODY_INCLUDE, EVAL_PAGE, SKIP_BODY, SKIP_PAGE| Constructor and Description |
|---|
InputLabelTag() |
| Modifier and Type | Method and Description |
|---|---|
int |
doAfterBody()
Does nothing.
|
int |
doEndInputTag()
Performs the main work of the tag as described in the class level javadoc.
|
void |
doInitBody()
Does nothing.
|
int |
doStartInputTag()
Does nothing.
|
String |
getFor()
Gets the HTML ID of the field for which this is a label.
|
protected void |
loadErrors()
Wraps the parent loadErrors() to suppress exceptions when the label is outside of a
stripes form tag.
|
protected void |
registerWithParentForm()
Overridden to do nothing, since a label isn't really a form field.
|
void |
setFor(String forId)
Sets the HTML ID of the field for which this is a label.
|
void |
setName(String name)
Sets the name of the form element/label to be rendered.
|
doCatch, doEndTag, doFinally, doStartTag, format, format, getActionBean, getDisabled, getFieldErrors, getFormatPattern, getFormatType, getLocalizedFieldName, getLocalizedFieldName, getName, getOverrideValueOrValues, getParentFormTag, getReadonly, getSingleOverrideValue, getSize, getValidationMetadata, getValueOnPage, hasErrors, isItemSelected, makeFocused, setDisabled, setFocus, setFormatPattern, setFormatType, setReadonly, setSizeevaluateExpression, get, getAccesskey, getAttributes, getBodyContent, getBodyContentAsString, getCssClass, getDir, getId, getLang, getOnblur, getOnchange, getOnclick, getOndblclick, getOnfocus, getOnkeydown, getOnkeypress, getOnkeyup, getOnmousedown, getOnmousemove, getOnmouseout, getOnmouseover, getOnmouseup, getOnselect, getStyle, getTabindex, getTitle, isXmlTags, release, set, setAccesskey, setBodyContent, setClass, setCssClass, setDir, setDynamicAttribute, setId, setLang, setOnblur, setOnchange, setOnclick, setOndblclick, setOnfocus, setOnkeydown, setOnkeypress, setOnkeyup, setOnmousedown, setOnmousemove, setOnmouseout, setOnmouseover, setOnmouseup, setOnselect, setStyle, setTabindex, setTitle, toString, writeAttributes, writeCloseTag, writeOpenTag, writeSingletonTaggetActionBeanType, getActionBeanUrl, getPageContext, getParent, getParentTag, getTagStack, popPageContextAttributes, pushPageContextAttributes, setPageContext, setParentclone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitsetBodyContentdoEndTag, doStartTag, getParent, release, setPageContext, setParentpublic void setFor(String forId)
public String getFor()
public void setName(String name)
setName in class InputTagSupportpublic int doStartInputTag()
throws JspException
doStartInputTag in class InputTagSupportJspExceptionpublic void doInitBody()
throws JspException
doInitBody in interface BodyTagJspExceptionpublic int doAfterBody()
throws JspException
doAfterBody in interface IterationTagJspExceptionpublic int doEndInputTag()
throws JspException
doEndInputTag in class InputTagSupportJspException - if an IOException is encountered writing to the output stream.protected void registerWithParentForm()
throws StripesJspException
registerWithParentForm in class InputTagSupportStripesJspException - if the parent form tag is not foundprotected void loadErrors()
loadErrors in class InputTagSupport© Copyright 2005-2006, Stripes Development Team.