|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectnet.sourceforge.stripes.tag.StripesTagSupport
net.sourceforge.stripes.tag.HtmlTagSupport
net.sourceforge.stripes.tag.InputTagSupport
net.sourceforge.stripes.tag.InputLabelTag
public class InputLabelTag
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!
Field Summary |
---|
Fields inherited from class net.sourceforge.stripes.tag.InputTagSupport |
---|
errorRenderer, fieldErrors |
Fields inherited from class net.sourceforge.stripes.tag.StripesTagSupport |
---|
pageContext, parentTag |
Fields inherited from interface javax.servlet.jsp.tagext.BodyTag |
---|
EVAL_BODY_BUFFERED, EVAL_BODY_TAG |
Fields inherited from interface javax.servlet.jsp.tagext.IterationTag |
---|
EVAL_BODY_AGAIN |
Fields inherited from interface javax.servlet.jsp.tagext.Tag |
---|
EVAL_BODY_INCLUDE, EVAL_PAGE, SKIP_BODY, SKIP_PAGE |
Constructor Summary | |
---|---|
InputLabelTag()
|
Method Summary | |
---|---|
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. |
Methods inherited from class net.sourceforge.stripes.tag.InputTagSupport |
---|
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, setSize |
Methods inherited from class net.sourceforge.stripes.tag.HtmlTagSupport |
---|
evaluateExpression, 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, 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, writeSingletonTag |
Methods inherited from class net.sourceforge.stripes.tag.StripesTagSupport |
---|
getActionBeanType, getActionBeanUrl, getPageContext, getParent, getParentTag, getTagStack, popPageContextAttributes, pushPageContextAttributes, setPageContext, setParent |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Methods inherited from interface javax.servlet.jsp.tagext.BodyTag |
---|
setBodyContent |
Methods inherited from interface javax.servlet.jsp.tagext.Tag |
---|
doEndTag, doStartTag, getParent, release, setPageContext, setParent |
Constructor Detail |
---|
public InputLabelTag()
Method Detail |
---|
public void setFor(String forId)
public String getFor()
public void setName(String name)
setName
in class InputTagSupport
public int doStartInputTag() throws JspException
doStartInputTag
in class InputTagSupport
JspException
public void doInitBody() throws JspException
doInitBody
in interface BodyTag
JspException
public int doAfterBody() throws JspException
doAfterBody
in interface IterationTag
JspException
public int doEndInputTag() throws JspException
doEndInputTag
in class InputTagSupport
JspException
- if an IOException is encountered writing to the output stream.protected void registerWithParentForm() throws StripesJspException
registerWithParentForm
in class InputTagSupport
StripesJspException
- if the parent form tag is not foundprotected void loadErrors()
loadErrors
in class InputTagSupport
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |